Background - Beyond text
• Hypertext is text which is not constrained to be linear. Hypertext is text
which contains links to other texts.
——《Computer Lib/Dream Machines》 Ted Nelson
The First Website
• http://info.cern.ch/hypertext/WWW/TheProject.html
HTTP Message Structure — Start Line
• Method• OPTIONS/GET/HEAD/POST/PUT/DELETE/TRACE/CONNECT
• http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
• URL• URL is an impl of URI
• Status Code(Response)• 1xx/2xx/3xx/4xx/5xx
• http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
• Reason-Phrase(Response)• 200 OK, 404 Not Found,
• CRLF• Carriage-Return \r Line-Feed \n
HTTP Message Structure — Headers
• Request Headers• Accept headers:
• Accept, Accept-Charset, Accept-Encoding , Accept-Language
• Conditional request headers:
• If-Match, If-None-Match, If-Modified-Since, If-Unmodified-Since
• Request security headers:
• Authorization, Cookie, Cookie2
• Proxy request headers:
• Max-Forwards, Proxy-Authorization, Proxy-Connection
HTTP Message Structure — Headers
• Response Headers• Negotiation headers:
• Accept-Ranges, Vary
• Response security headers:
• Proxy-Authenticate, Set-Cookie, Set-Cookie2, WWW-Authenticate, Access-Control-Allow-Origin
• Content cache headers:
• ETag, Last-Modified, Expires, Cache-Control
HTTP Message Structure — Body
• Content Headers• Content-Type
• Content-Type: application/x-www-form-urlencoded
• Content-Type: text/html; charset=utf-8
• Content-Length
• Content-Encoding
• Content-Range
• Content-Language
Persistent Connection
• Why Keep-Alive• The TCP connection setup handshake
• TCP slow-start congestion control
• Nagle’s Algorithm and TCP_NODELAY
• HTTP 1.0• Connection: Keep-Alive
• HTTP 1.1• By Default Keep Alive
• To Close: Connection: Close
Caching
• Browser Caching• Document Expires?
• Cache-Control: max-age=604800
• Expire: Tue, 07 Apr 2015 15:26:18 GMT
Content-Type — Internet media type
• image/audio/video/text/application/multipart
• http://en.wikipedia.org/wiki/Internet_media_type
• Application• application/x-www-form-urlencoded
• Query String => Post Body
• application/xml, application/json
Content-Type — Multipart & MIME
• Multipart• multipart/form-data
• MIME—Multi-Purpose Internet Mail Extensions
H t t p v e r s i o n s
• HTTP V 0.9(1991)• Request-Response, only GET
• HTTP V 1.0(1992 draft,1996 release)• Version Code, More Operations, Headers, Mime
• HTTP V 1.1(1992 draft,1999 release)• Keep-alive, Proxy
• HTTP V 2.0(2014 draft,? release)• Header Compression, Parallel Loading over single connection