NSURLConnection by default performs a GET request with HTTP v1.1.
How do I get it to perform a GET request with HTTP v1.0?
Or is there a HTTP header I can set that will do this for me?
NSURLConnection by default performs a GET request with HTTP v1.1.
How do I get it to perform a GET request with HTTP v1.0?
Or is there a HTTP header I can set that will do this for me?
After a quick look through the NSURLRequest APIs I don't see any way of doing this from that level, but you can do it by dropping down to the HTTPMessage APIs in CFNetwork.framework (CoreServices.framework on the Mac). For instance:
CFHTTPMessageRef request = CFHTTPMessageCreateRequest( kCFAllocatorDefault,
CFSTR("GET"), theURL, kCFHTTPVersion1_0 );
If you want an ObjC wrapper around this, there are a few available, including one of my own devising. That one is a fairly basic wrapper around the CF API, but you can get an NSInputStream from it which you can use to read the response data using the standard NSInputStream APIs.
Others, such as ASIHTTPRequest provide a much larger API, which you might prefer.
The latest version of ASIHTTPRequest has an easy way to do this:
[request setUseHTTPVersionOne:YES];