25
Introduction to HTTP History, Knowledge and Usages [email protected] 2015.4.1

Introduction to HTTP

Embed Size (px)

Citation preview

Introduction to HTTP

History, Knowledge and Usages

[email protected]

2015.4.1

O U T L I N E

• History

• HTTP Basics

• Extended Topics

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

W h a t i s “ h y p e r ” ?

P r o j e c t X a n a d u ( 1 9 6 0 - 2 0 1 4 ? )

The Birth of Web 1989

• Tim Beners-Lee @CERN

T h e F i r s t B r o w s e r

• “WorldWideWeb”(Nexus)

The First Web Server

• CERN httpd on NeXT

The First Website

• http://info.cern.ch/hypertext/WWW/TheProject.html

WWW and Internet

O U T L I N E

• History

• HTTP Basics

• Extended Topics

HTTP Message Structure

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

O U T L I N E

• History

• HTTP Basics

• Extended Topics

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

Caching — Revalidation with Server

• Date • Tag

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

Range

• Response• Content-Length/ Accept-Ranges

• Request• Range

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

E n d

• Thanks!