diff options
author | Jay Freeman <saurik@saurik.com> | 2008-04-23 21:21:22 +0000 |
---|---|---|
committer | Jay Freeman <saurik@saurik.com> | 2008-04-23 21:21:22 +0000 |
commit | 9746156637461df00082f6a468e66b7384079f7d (patch) | |
tree | c84863545e0643d6fc22a6ee07e4d3dbc629c2bf /data | |
parent | 060ce211e1469d0c74e4c20145c4c659e62a6b27 (diff) |
Added iPhone headers to APT and fixed 301 results.
git-svn-id: http://svn.telesphoreo.org/trunk@235 514c082c-b64e-11dc-b46d-3d985efe055d
Diffstat (limited to 'data')
-rw-r--r-- | data/apt/cfnetwork.diff | 56 |
1 files changed, 49 insertions, 7 deletions
diff --git a/data/apt/cfnetwork.diff b/data/apt/cfnetwork.diff index e90d06dde..6fbec5cf4 100644 --- a/data/apt/cfnetwork.diff +++ b/data/apt/cfnetwork.diff @@ -1,7 +1,15 @@ diff -ru apt-0.6.46.4.1/methods/http.cc apt-0.6.46.4.1+iPhone/methods/http.cc --- apt-0.6.46.4.1/methods/http.cc 2006-12-04 14:37:36.000000000 +0000 -+++ apt-0.6.46.4.1+iPhone/methods/http.cc 2008-04-21 18:19:27.000000000 +0000 -@@ -43,6 +47,11 @@ ++++ apt-0.6.46.4.1+iPhone/methods/http.cc 2008-04-23 11:36:59.000000000 +0000 +@@ -30,6 +34,7 @@ + #include <apt-pkg/error.h> + #include <apt-pkg/hashes.h> + ++#include <sys/sysctl.h> + #include <sys/stat.h> + #include <sys/time.h> + #include <utime.h> +@@ -43,6 +48,11 @@ // Internet stuff #include <netdb.h> @@ -13,10 +21,13 @@ diff -ru apt-0.6.46.4.1/methods/http.cc apt-0.6.46.4.1+iPhone/methods/http.cc #include "connect.h" #include "rfc2553emu.h" -@@ -51,6 +60,47 @@ +@@ -51,6 +61,50 @@ /*}}}*/ using namespace std; ++const char *Machine_; ++const char *SerialNumber_; ++ +void CfrsError(const char *name, CFReadStreamRef rs) { + CFStreamError se = CFReadStreamGetError(rs); + @@ -61,7 +72,7 @@ diff -ru apt-0.6.46.4.1/methods/http.cc apt-0.6.46.4.1+iPhone/methods/http.cc string HttpMethod::FailFile; int HttpMethod::FailFd = -1; time_t HttpMethod::FailTime = 0; -@@ -1062,159 +1112,251 @@ +@@ -1062,159 +1116,259 @@ if (Queue == 0) continue; @@ -76,7 +87,7 @@ diff -ru apt-0.6.46.4.1/methods/http.cc apt-0.6.46.4.1+iPhone/methods/http.cc + + char *url = strdup(Queue->Uri.c_str()); + url: -+ URI uri = Queue->Uri; ++ URI uri = std::string(url); + std::string hs = uri.Host; + + struct hostent *he = gethostbyname(hs.c_str()); @@ -168,6 +179,14 @@ diff -ru apt-0.6.46.4.1/methods/http.cc apt-0.6.46.4.1+iPhone/methods/http.cc - continue; - } - }; ++ sr = CFStringCreateWithCString(kCFAllocatorDefault, Machine_, se); ++ CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("X-Machine"), sr); ++ CFRelease(sr); ++ ++ sr = CFStringCreateWithCString(kCFAllocatorDefault, SerialNumber_, se); ++ CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("X-Serial-Number"), sr); ++ CFRelease(sr); ++ + CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("User-Agent"), CFSTR("Telesphoreo APT-HTTP/1.0.98")); + + sr = CFStringCreateWithCString(kCFAllocatorDefault, hs.c_str(), se); @@ -450,15 +469,38 @@ diff -ru apt-0.6.46.4.1/methods/http.cc apt-0.6.46.4.1+iPhone/methods/http.cc FailCounter = 0; } +@@ -1224,6 +1378,22 @@ + setlocale(LC_ALL, ""); + + HttpMethod Mth; ++ ++ size_t size; ++ sysctlbyname("hw.machine", NULL, &size, NULL, 0); ++ char *machine = new char[size]; ++ sysctlbyname("hw.machine", machine, &size, NULL, 0); ++ Machine_ = machine; ++ ++ if (CFMutableDictionaryRef dict = IOServiceMatching("IOPlatformExpertDevice")) ++ if (io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, dict)) { ++ if (CFTypeRef serial = IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformSerialNumberKey), kCFAllocatorDefault, 0)) { ++ SerialNumber_ = strdup(CFStringGetCStringPtr((CFStringRef) serial, CFStringGetSystemEncoding())); ++ CFRelease(serial); ++ } ++ ++ IOObjectRelease(service); ++ } + + return Mth.Loop(); + } diff -ru apt-0.6.46.4.1/methods/makefile apt-0.6.46.4.1+iPhone/methods/makefile --- apt-0.6.46.4.1/methods/makefile 2006-12-04 14:37:36.000000000 +0000 -+++ apt-0.6.46.4.1+iPhone/methods/makefile 2008-04-14 20:17:16.000000000 +0000 ++++ apt-0.6.46.4.1+iPhone/methods/makefile 2008-04-22 04:03:43.000000000 +0000 @@ -47,7 +47,7 @@ # The http method PROGRAM=http -SLIBS = -lapt-pkg $(SOCKETLIBS) -+SLIBS = -lapt-pkg $(SOCKETLIBS) -framework CFNetwork -framework CoreFoundation -framework SystemConfiguration ++SLIBS = -lapt-pkg $(SOCKETLIBS) -framework CFNetwork -framework CoreFoundation -framework SystemConfiguration -framework IOKit LIB_MAKES = apt-pkg/makefile SOURCE = http.cc rfc2553emu.cc connect.cc include $(PROGRAM_H) |