]> git.saurik.com Git - apt-legacy.git/commitdiff
Fixed the DNS blocking problem on APT.
authorJay Freeman (saurik) <saurik@saurik.com>
Sat, 26 Apr 2008 18:01:08 +0000 (18:01 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Sat, 26 Apr 2008 18:01:08 +0000 (18:01 +0000)
M cfnetwork.diff

git-svn-id: http://svn.telesphoreo.org/trunk@247 514c082c-b64e-11dc-b46d-3d985efe055d

methods/http.cc
methods/http.cc.orig

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);
index 28c608d2405fe6f4ad654f6f0726c2635cb9272d..3410a3e1f1b6de1b734b2ef788f3b4733875ffa4 100644 (file)
@@ -1120,6 +1120,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));
@@ -1128,6 +1129,7 @@ int HttpMethod::Loop()
       }
 
       uri.Host = inet_ntoa(* (struct in_addr *) he->h_addr_list[0]);
+#endif
 
       std::string urs = uri;
 
@@ -1162,9 +1164,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);