Web and HTTP
Review
- Web page consist of objects
- object can be HTML file, JPEG image, audio file…
- web page consists of base HTML file which includes several referenced objects
HTTP Oerview
HTTP: hypertext transfer protocol
- client: send request and displays web objects
- server: send responses to client
Features
- HTTP is stateless
- server maintains no information about past client
- HTTP uses TCP
- client init TCP connection
- server accepts TCP connection from client
- HTTP message exchanged between client and server
HTTP Connection
Non-persistent HTTP (HTTP 1.0)
- HTTP client initiate TCP connection to HTTP server port 80
- HTTP server at host accepts connection and notifying client
- request
- response
- TCP Close
- Steps 1-5 repeated for each of objects
Features
- requires 2 RTTs per object
- OS overhead for each TCP connection
Persistent HTTP (HTTP 1.1)
Features
- server leaves connection open after sending response
- as little as one RTT for all the referenced objects (cutting response time in half)
pipelined GETs (HTTP 1.1)
HTTP request message
- Two types of HTTP messages: request, response
- HTTP request message
- ASCII (human-readable format)
Other HTTP request messages
HTTP response message
HTTP response status codes
status code appears in 1st line
- 200: OK
- 301: Moved Permanently
- 400: Bad Request
- 404: Not Found
- 505: HTTP Version Not Supported