Changeset 277 for trunk/data/apt

Show
Ignore:
Timestamp:
05/11/08 06:38:34 (8 months ago)
Author:
saurik
Message:

Added X-Firmware to APT.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/data/apt/cfnetwork.diff

    r247 r277  
    11diff -ru apt-0.6.46.4.1/methods/http.cc apt-0.6.46.4.1+iPhone/methods/http.cc 
    22--- apt-0.6.46.4.1/methods/http.cc      2006-12-04 14:37:36.000000000 +0000 
    3 +++ apt-0.6.46.4.1+iPhone/methods/http.cc       2008-04-25 09:29:12.000000000 +0000 
     3+++ apt-0.6.46.4.1+iPhone/methods/http.cc       2008-05-11 06:33:29.000000000 +0000 
    44@@ -30,6 +34,7 @@ 
    55 #include <apt-pkg/error.h> 
     
    2222 #include "connect.h" 
    2323 #include "rfc2553emu.h" 
    24 @@ -51,6 +61,50 @@ 
     24@@ -51,6 +61,51 @@ 
    2525                                                                        /*}}}*/ 
    2626 using namespace std; 
    2727  
     28+CFStringRef Firmware_; 
    2829+const char *Machine_; 
    2930+const char *SerialNumber_; 
     
    7374 int HttpMethod::FailFd = -1; 
    7475 time_t HttpMethod::FailTime = 0; 
    75 @@ -1062,159 +1116,263 @@ 
     76@@ -1062,159 +1117,266 @@ 
    7677  
    7778       if (Queue == 0) 
     
    184185+      } 
    185186+ 
     187+      if (Firmware_ != NULL) 
     188+         CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("X-Firmware"), Firmware_); 
     189+ 
    186190+      sr = CFStringCreateWithCString(kCFAllocatorDefault, Machine_, se); 
    187191+      CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("X-Machine"), sr); 
     
    476480    } 
    477481     
    478 @@ -1224,6 +1382,22 @@ 
     482@@ -1224,6 +1386,39 @@ 
    479483    setlocale(LC_ALL, ""); 
    480484  
     
    486490+    sysctlbyname("hw.machine", machine, &size, NULL, 0); 
    487491+    Machine_ = machine; 
     492+ 
     493+    const char *path = "/System/Library/CoreServices/SystemVersion.plist"; 
     494+    CFURLRef url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (uint8_t *) path, strlen(path), false); 
     495+ 
     496+    CFPropertyListRef plist; { 
     497+        CFReadStreamRef stream = CFReadStreamCreateWithFile(kCFAllocatorDefault, url); 
     498+        CFReadStreamOpen(stream); 
     499+        plist = CFPropertyListCreateFromStream(kCFAllocatorDefault, stream, 0, kCFPropertyListImmutable, NULL, NULL); 
     500+        CFReadStreamClose(stream); 
     501+    } 
     502+ 
     503+    CFRelease(url); 
     504+ 
     505+    if (plist != NULL) { 
     506+        Firmware_ = (CFStringRef) CFRetain(CFDictionaryGetValue((CFDictionaryRef) plist, CFSTR("ProductVersion"))); 
     507+        CFRelease(plist); 
     508+    } 
    488509+ 
    489510+    if (CFMutableDictionaryRef dict = IOServiceMatching("IOPlatformExpertDevice")) 
     
    501522diff -ru apt-0.6.46.4.1/methods/makefile apt-0.6.46.4.1+iPhone/methods/makefile 
    502523--- apt-0.6.46.4.1/methods/makefile     2006-12-04 14:37:36.000000000 +0000 
    503 +++ apt-0.6.46.4.1+iPhone/methods/makefile      2008-04-23 11:40:38.000000000 +0000 
     524+++ apt-0.6.46.4.1+iPhone/methods/makefile      2008-05-11 06:32:33.000000000 +0000 
    504525@@ -47,7 +47,7 @@ 
    505526  
     
    507528 PROGRAM=http 
    508529-SLIBS = -lapt-pkg $(SOCKETLIBS) 
    509 +SLIBS = -lapt-pkg $(SOCKETLIBS) -framework CFNetwork -framework CoreFoundation -framework SystemConfiguration -framework IOKit 
     530+SLIBS = -lapt-pkg $(SOCKETLIBS) -framework CoreFoundation -framework CFNetwork -framework SystemConfiguration -framework IOKit 
    510531 LIB_MAKES = apt-pkg/makefile 
    511532 SOURCE = http.cc rfc2553emu.cc connect.cc