4. HTTP Flashcards
What are the 2 general types of HTTP messages?
Request and response. Client’s browser (aka user agent) requests, receives and renders Web objects. Server sends objects in reponse to the requests.
What are the 4 common HTTP methods? Describe them.
GET: typically a request for a file.
HEAD: returns header information e.g last-modified date, size, content-type. Should be indentical to the header part of a GET response.
POST: submits user input usually from a form.
Conditional GET: Conditional fields include: If-Modified-Since, If-Match, If-Range. Requests that the entity be transferred ony under the circumstances described. Reduces unnecessary network usage by allowing cached entities to be refreshed without mutliple requests.
How does the conditional-GET request reduce network usage?
Reduces unnecessary network usage by allowing cached entities to be refreshed without mutliple requests
Describe both methods of uploading form input.
POST method - web page includes a form input, input is uploaded to server in entity body
URL method - uses GET method, input is uploaded in URL field of request line:
www.somesite.com/animalsearch?monkeys&banana
HTTP is stateless. What does this mean, and why is this an advantage?
This means that the server maintains no information about past client requests.
Protocols that maintain state are potentially complex:
- past history must be maintained
- if client/server crashes their views of state may be incosistent with the other and must be reconciled
What is the relationship between HTTP 1.0 and TCP?
HTTP 1.0 used a single TCP connection for each request/response transaction, so multiple transactions between the same client and server needed multiple TCP connections. HTTP 1.1 introduced means to keep the TCP connection open, reducing congestion. e.g keep-alive: 115/r/n
What are the 5 types of HTTP response codes?
1xx - Informational 2xx - Successful 3xx - Redirection 4xx - Client Error 5xx - Server Error
What can cookies be used for?
- authorization
- shopping carts
- recommendations
- user session state (http messages can carry state)