HTTP (Hypertext Transfer Protocol)
HTTP first step
client (usually web browser) connects to web server (MS IIS r Apache HTTP Server)
HTTP second step
client and server exchange messages (request & response)
How is HTTP related to TCP protocol?
It works on top of TCP.
What is the format of an HTTP message?
How do you end lines in HTTP?
\r : carriage return
\n: newline
What is the format of an HTTP header field?
Header-name: header value
HTTP verb
- state the type of request
GET request
used when opening web resources
After the HTTP verb, there is a path. What does the path do?
tells server which resources the browser is asking for
After the HTTP verb and path, there is the protocol version. What is the protocol version?
tells server how to communicate with the browser
What is the structure of the first line of an HTTP request?
HTTP VERB, path, protocol version
What does the HTTP Request Host header field specify?
URI
identifies a specific resuorce: page, book, document
URL
- tells you how to access the resource: HTTPS, FTP
User-Agent
tell server what client software & version is issuing the request: Firefox, Safari, Chrome, etc
Accept header field
specifies which document type it is expecting in response
Accept-Encoding
restricts content encoding, not the content itself.
• for example, the browser will accept two types of compression if read “: gzip, deflate”
Connection header
allows sender to specify options that are desired for that particular connection
• for example, future comms w/ server will reuse current connection if “keep-alive”
HTTP Response: Status-Line
Status Code: 200
- resource found
Status Code: 301
- resource has been assigned a new permanent URI
Status Code: 302
- temporarily under another URI
Status Code: 403
- client doesn’t have enough privileges, server refuses to fulfill request