30      if ( !conf.geoipEnabled() ) {
 
   31        MIL << 
"GeoIp rewrites disabled via ZConfig." << std::endl;
 
   35      if ( !( 
url.getQueryParam(
"COUNTRY").empty() && 
url.getQueryParam(
"AVOID_COUNTRY").empty() )) {
 
   36        MIL << 
"GeoIp rewrites disabled since the baseurl " << 
url << 
" uses an explicit country setting." << std::endl;
 
   40      const auto &hostname = 
url.getHost();
 
   41      auto geoipFile = conf.geoipCachePath() / hostname ;
 
   42      if ( 
PathInfo( geoipFile ).isFile() ) {
 
   44        MIL << 
"Found GeoIP file for host: " << hostname << std::endl;
 
   46        std::ifstream in( geoipFile.asString() );
 
   48          MIL << 
"Failed to open GeoIP for host: " << hostname << std::endl;
 
   59          MIL << 
"Found GeoIP rewrite: " << hostname << 
" -> " << newHost << std::endl;
 
   65          MIL << 
"No valid GeoIP rewrite target found for " << 
url << std::endl;
 
   70      MIL << 
"Failed to query GeoIP data, url rewriting disabled." << std::endl;
 
 
   85                                                  "X-ZYpp-AnonymousId: %s",
 
   88    return _value.c_str();
 
 
   99                                                  "X-ZYpp-DistributionFlavor: %s",
 
  102    return _value.c_str();
 
 
  107    static const zypp::str::regex invalidRewrites(
"^.*\\/repomd.xml(.asc|.key)?$|^\\/geoip$");
 
  113      MIL << 
"Redirecting " << filename_r << 
" request to geoip location." << std::endl;
 
  116    Url newurl { baseUrl };
 
 
  128                                                "ZYpp " LIBZYPP_VERSION_STRING 
" (curl %s) %s",
 
  129                                                curl_version_info(CURLVERSION_NOW)->version,
 
  131    return _value.c_str();
 
 
Base class for Exception.
std::string distributionFlavor() const
This is flavor attribute of the installed base product but does not require the target to be loaded a...
std::string anonymousUniqueId() const
anonymous unique id
std::string targetDistribution() const
This is register.target attribute of the installed base product.
void setHost(const std::string &host)
Set the hostname or IP in the URL authority.
void appendPathName(const Pathname &path_r, EEncoding eflag_r=zypp::url::E_DECODED)
Extend the path name.
static ZConfig & instance()
Singleton ctor.
Wrapper class for stat/lstat.
const std::string & asString() const
String representation.
bool matches(const char *s, str::smatch &matches, int flags=none) const
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
std::string trim(const std::string &s, const Trim trim_r)
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).