diff options
author | Jay Freeman <saurik@saurik.com> | 2008-05-11 06:38:34 +0000 |
---|---|---|
committer | Jay Freeman <saurik@saurik.com> | 2008-05-11 06:38:34 +0000 |
commit | 354ad9a26e61d5b49583a62de65ae24ac1199828 (patch) | |
tree | 95b0df1f987bc9c8114d5666b48f0d97af06335b /data/apt/cfnetwork.diff | |
parent | 66672a0bb3d3f820da7d9e0c35b6fa068e3aa952 (diff) |
Added X-Firmware to APT.
git-svn-id: http://svn.telesphoreo.org/trunk@277 514c082c-b64e-11dc-b46d-3d985efe055d
Diffstat (limited to 'data/apt/cfnetwork.diff')
-rw-r--r-- | data/apt/cfnetwork.diff | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/data/apt/cfnetwork.diff b/data/apt/cfnetwork.diff index 8d8735e33..f233df383 100644 --- a/data/apt/cfnetwork.diff +++ b/data/apt/cfnetwork.diff @@ -1,6 +1,6 @@ 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-25 09:29:12.000000000 +0000 ++++ apt-0.6.46.4.1+iPhone/methods/http.cc 2008-05-11 06:33:29.000000000 +0000 @@ -30,6 +34,7 @@ #include <apt-pkg/error.h> #include <apt-pkg/hashes.h> @@ -21,10 +21,11 @@ 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 +61,50 @@ +@@ -51,6 +61,51 @@ /*}}}*/ using namespace std; ++CFStringRef Firmware_; +const char *Machine_; +const char *SerialNumber_; + @@ -72,7 +73,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 +1116,263 @@ +@@ -1062,159 +1117,266 @@ if (Queue == 0) continue; @@ -183,6 +184,9 @@ diff -ru apt-0.6.46.4.1/methods/http.cc apt-0.6.46.4.1+iPhone/methods/http.cc + CFRelease(sr); + } + ++ if (Firmware_ != NULL) ++ CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("X-Firmware"), Firmware_); ++ + sr = CFStringCreateWithCString(kCFAllocatorDefault, Machine_, se); + CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("X-Machine"), sr); + CFRelease(sr); @@ -475,7 +479,7 @@ 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 +1382,22 @@ +@@ -1224,6 +1386,39 @@ setlocale(LC_ALL, ""); HttpMethod Mth; @@ -486,6 +490,23 @@ diff -ru apt-0.6.46.4.1/methods/http.cc apt-0.6.46.4.1+iPhone/methods/http.cc + sysctlbyname("hw.machine", machine, &size, NULL, 0); + Machine_ = machine; + ++ const char *path = "/System/Library/CoreServices/SystemVersion.plist"; ++ CFURLRef url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (uint8_t *) path, strlen(path), false); ++ ++ CFPropertyListRef plist; { ++ CFReadStreamRef stream = CFReadStreamCreateWithFile(kCFAllocatorDefault, url); ++ CFReadStreamOpen(stream); ++ plist = CFPropertyListCreateFromStream(kCFAllocatorDefault, stream, 0, kCFPropertyListImmutable, NULL, NULL); ++ CFReadStreamClose(stream); ++ } ++ ++ CFRelease(url); ++ ++ if (plist != NULL) { ++ Firmware_ = (CFStringRef) CFRetain(CFDictionaryGetValue((CFDictionaryRef) plist, CFSTR("ProductVersion"))); ++ CFRelease(plist); ++ } ++ + if (CFMutableDictionaryRef dict = IOServiceMatching("IOPlatformExpertDevice")) + if (io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, dict)) { + if (CFTypeRef serial = IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformSerialNumberKey), kCFAllocatorDefault, 0)) { @@ -500,13 +521,13 @@ diff -ru apt-0.6.46.4.1/methods/http.cc apt-0.6.46.4.1+iPhone/methods/http.cc } 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-23 11:40:38.000000000 +0000 ++++ apt-0.6.46.4.1+iPhone/methods/makefile 2008-05-11 06:32:33.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 -framework IOKit ++SLIBS = -lapt-pkg $(SOCKETLIBS) -framework CoreFoundation -framework CFNetwork -framework SystemConfiguration -framework IOKit LIB_MAKES = apt-pkg/makefile SOURCE = http.cc rfc2553emu.cc connect.cc include $(PROGRAM_H) |