Professional Documents
Culture Documents
HTTP
HTTP
HTTP
Request/Response line
General headers
Request/Response headers
Headers
Entity headers
(one field in each line)
blank line
Entity Body
General headers
Header fields that are applicable to both requests and
response
Request Headers
Header fields specific to request messages only
HTTP Response Headers
Entity Headers
Header fields specifying attributes of the data sent
Status Codes
27.12
27.13
HTTP Request Example: GET
Method URL Protocol Version
General headers
Request headers
Entity headers
HTTP Response Example
Version Status Code Status Message
HTTP/1.1 200 OK
Date: Thu, 24 Mar 2022 17:43:21 GMT
Server: Apache/2.4.41
Headers
Content-Type: text/html
Content-Length: 1846
blank line
<html>
Entity Body ...
</html>
General headers
Response headers
Entity headers
HTTP Request Example: PUT
Method URL Protocol Version
HTTP/1.1 200 OK
Date: Thu, 24 Mar 2022 18:36:27 GMT
Server: Apache/2.4.41
Headers
General headers
Response headers
Entity headers
Persistent Connection
Non-persistent connection: one TCP connection made
for each request-response
Inefficient when downloading say a page with lots of
images etc. which will need to be downloaded anyway
Persistent connection: A connection is reused for
multiple request-response
Default for HTTP 1.1 onwards
The server can close the connection if client requests
(using connection header field) or on timeout
Persistent connections can also pipeline requests
Cookies
Small pieces of data that the server stores on client side
Server sends cookies using set-cookie response header field
Multiple set-cookie fields can be used to send more than one
piece of data
HTTP/2.0 200 OK
Content-Type: text/html
Set-Cookie: movie_seen=untouchables
Set-Cookie: actor=sean_connery
…
Can set expiry time on cookies also
Set-Cookie: name=ag; Expires=Thu, 30 APR 2022
10:30:00 GMT
Client sends on subsequent requests to same server/domain
Uses the cookie field in request header