I'm trying to understand NSHTTPCookieStorage's internals to be able to swizzle some methods to have a separate storage from cookie storage from Safari, something that's impossible by any non-hacky way as far as I can tell:
I located the header file here:
/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSHTTPCookieStorage.h
which doesn't give me much information except that the implementation should probably be in
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
I look at the symbol names in that library but I only found these ones mentioning NSHTTPCookieStorage:
$ nm /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation | grep -i cookiestorage
000000000030cbb5 S $ld$add$os10.5$_OBJC_CLASS_$_NSHTTPCookieStorage
000000000030cbb6 S $ld$add$os10.5$_OBJC_METACLASS_$_NSHTTPCookieStorage
000000000030cbb7 S $ld$add$os10.6$_OBJC_CLASS_$_NSHTTPCookieStorage
000000000030cbb8 S $ld$add$os10.6$_OBJC_METACLASS_$_NSHTTPCookieStorage
000000000030cbb9 S $ld$add$os10.7$_OBJC_CLASS_$_NSHTTPCookieStorage
000000000030cbba S $ld$add$os10.7$_OBJC_METACLASS_$_NSHTTPCookieStorage
000000000030cbbb S $ld$add$os10.8$_OBJC_CLASS_$_NSHTTPCookieStorage
000000000030cbbc S $ld$add$os10.8$_OBJC_METACLASS_$_NSHTTPCookieStorage
000000000030cbbd S $ld$add$os10.9$_OBJC_CLASS_$_NSHTTPCookieStorage
000000000030cbbe S $ld$add$os10.9$_OBJC_METACLASS_$_NSHTTPCookieStorage
I _OBJC_CLASS_$_NSHTTPCookieStorage (indirect for _OBJC_CLASS_$_NSHTTPCookieStorage)
U _OBJC_CLASS_$_NSHTTPCookieStorage
I _OBJC_METACLASS_$_NSHTTPCookieStorage (indirect for _OBJC_METACLASS_$_NSHTTPCookieStorage)
U _OBJC_METACLASS_$_NSHTTPCookieStorage
No methods at all. Doing a class dump of that library this is all the mentions of "Cookie" that I could find:
# class-dump /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation | grep -i cookie
@interface NSHTTPCookie (NSHTTPCookiePortCoding)
Things started to get a bit desperate, so I invoked strings!
$ strings /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation | grep -i cookie
setHTTPShouldHandleCookies:
NSHTTPCookiePortCoding
Using method swizzling, I wrapped a method around NSHTTPCookieStorage
's sharedHTTPCookieStorage
and then I tried to enter it with the XCode debugger to see if I could at least get to the assembly of that method, but XCode would jump right over any calls to a method of that class even when I tell it to go in.
It looks like the class is not even there. Where is that class defined? How can I get to its internals?