Graphics Programs Reference
In-Depth Information
For the More Curious: The Request Body
When
NSURLConnection
talks to a web server, it uses the HTTP protocol. This pro-
tocol says that any data you send or receive must follow the HTTP specification. The actual
data transferred to the server in this chapter is shown in
Figure 25.10
.
Figure 25.10 HTTP Request Format
NSURLRequest
has a number of methods that allow you to specify a piece of the request
and then properly format it for you.
Any service request has three parts: a request-line, the HTTP headers, and the HTTP body,
which is optional. The request-line (which Apple calls a status line) is the first line of the
request and tells the server what the client is trying to do. In this request, the client is trying
to
GET
the resource at
smartfeed.php?limit=1_DAY&etc
. (It also specifies the
HTTP specification version that the data is in.)
The command
GET
is an HTTP method. While there are a number of supported HTTP
methods, you typically only see
GET
and
POST
. The default of
NSURLRequest
,
GET
, in-