For the More Curious: HTTP

When NSURLSessionTask interacts with a web server, it does so according to the rules outlined in the HTTP specification. The specification is very clear about the exact format of the request/response exchange between the client and the server. An example of a simple HTTP request is shown in Figure 19.7.

Figure 19.7  HTTP request format

HTTP request format

An HTTP request has three parts: a request line, request headers, and an optional request body. The request 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

Get iOS Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.