[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PUT on OS X (NSURLConnection)




I read the following on Ecto author Adriaan Tijsseling's blog:


"10.3.7 was released yesterday. It fixes several issues with WarCraft, but yet again it does not fix a huge bug in the NSURLConnection framework: HTTP PUT lacking a body."[0]

Basically, it drops the body if the method is anything other than POST. However, Adriaan also posted a little demo XCode project that illustrated the issue with NSURLConnection.[1]

I took his demo, and modified it to use CoreFoundation HTTP functions[2]. Using CoreFoundation is a PITA, but it works and is guaranteed to be there. There are some niceties missing that you get from NSURLConnection (e.g. detecting system proxy settings), but they could be added and are mostly geared towards browser-esque apps. So, here's PUT in Cocoa:

http://franklinmint.fm/put_cfhttp.zip

The connection class is not very robust, it's just a proof of concept, so there would be more work to do in order to use it in something like Ecto. But not that much.

Robert Sayre

[0] http://blog.kung-foo.tv/archives/001238.php
[1] http://blog.kung-foo.tv/PUT.zip
[2] http://developer.apple.com/documentation/Networking/Conceptual/CFNetwork/Chapter_3/chapter_4_section_20.html