]> git.saurik.com Git - apt-legacy.git/blobdiff - methods/http.cc
Fixed the DNS blocking problem on APT.
[apt-legacy.git] / methods / http.cc
index f27408e9b1d974ff9564d7fd15e528e168a71c84..678c5f59580e4757ff8c3a9bfd525d3ce0d262f9 100644 (file)
@@ -1124,6 +1124,7 @@ int HttpMethod::Loop()
       URI uri = std::string(url);
       std::string hs = uri.Host;
 
+#if __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ >= 10200
       struct hostent *he = gethostbyname(hs.c_str());
       if (he == NULL || he->h_addr_list[0] == NULL) {
          _error->Error(hstrerror(h_errno));
@@ -1132,6 +1133,7 @@ int HttpMethod::Loop()
       }
 
       uri.Host = inet_ntoa(* (struct in_addr *) he->h_addr_list[0]);
+#endif
 
       std::string urs = uri;
 
@@ -1166,9 +1168,11 @@ int HttpMethod::Loop()
 
       CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("User-Agent"), CFSTR("Telesphoreo APT-HTTP/1.0.98"));
 
+#if __ENVIRONMENT_ASPEN_VERSION_MIN_REQUIRED__ >= 10200
       sr = CFStringCreateWithCString(kCFAllocatorDefault, hs.c_str(), se);
       CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("Host"), sr);
       CFRelease(sr);
+#endif
 
       CFReadStreamRef rs = CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, hm);
       CFRelease(hm);