Valerii  Pavlov
Valerii Pavlov

Reputation: 2033

NSURLRequest http protocol version

It is quite a simple question from me today. Is it possible to set specific HTTP protocol version to NSURLRequest object (1.0 or 1.1, for example)?

An example of what I'm talking about on telnet:

pavlov:~ pavlov$ telnet ya.ru 80
Trying 87.250.250.3...
Connected to ya.ru.
Escape character is '^]'.
GET /index.php HTTP/1.0

Upvotes: 4

Views: 3914

Answers (1)

Nicolas Bachschmidt
Nicolas Bachschmidt

Reputation: 6505

You cannot change the HTTP version of a NSURLRequest. However you can use the CFNetwork framework. It's the C framework on top of which NSURLConnection is based.

The CFHTTPMessageCreateRequest function creates a new message with an arbitrary HTTP protocol version. Then, that message may be used to create an input stream using the CFReadStreamCreateForHTTPRequest function.

Documentation: CFNetwork - Communicating with HTTP Servers

Upvotes: 2

Related Questions