From 44db0cb781b86af2a32f65aff4f191a4d99086ca Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sat, 26 Apr 2008 18:01:08 +0000 Subject: [PATCH] Fixed the DNS blocking problem on APT. M cfnetwork.diff git-svn-id: http://svn.telesphoreo.org/trunk@247 514c082c-b64e-11dc-b46d-3d985efe055d --- methods/http.cc | 4 ++++ methods/http.cc.orig | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/methods/http.cc b/methods/http.cc index f27408e..678c5f5 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -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); diff --git a/methods/http.cc.orig b/methods/http.cc.orig index 28c608d..3410a3e 100644 --- a/methods/http.cc.orig +++ b/methods/http.cc.orig @@ -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); -- 2.50.0