HTTP is a protocol for transmitting hypertext documents across the internet. It was introduced in 1989 along with HTML to allow hypertext documents to be fetched via the internet. HTTP works by having clients make requests to servers using methods like GET and POST, and servers respond with status codes and headers along with content in the response body. Key aspects of HTTP include URLs, requests, responses, status codes, headers, and common mistakes around character encodings, caching, and cookies.
4. A long time ago…
1945 First description of a link-based information system.
1965 The term ‘hypertext’ coined for text containing links.
1970s Many hypertext computer systems implemented.
1980s The Internet becomes widely used by scientists.
1989 WorldWideWeb project introduces HTML to describe
hypertext documents and HTTP to fetch them via Internet.
1991 HTTP 0.9, 1996 HTTP 1.0, 1997-1999 HTTP 1.1
2015 HTTP 2 4@PeterHilton •
5. HTTP = hypertext + Internet
5@PeterHilton •
The Internet is a communications network.
HTTP - Hypertext Transfer Protocol is an Internet
communication protocol.
HTML - Hypertext Markeup Language is a text-based markup
language for writing hypertext documents.
Internet + HTTP + HTML = the web
18. HTTP request methods
GET - fetch a resource
HEAD - returns the same headers as GET, but no body
POST - send a resource
PUT - replace a resource
DELETE - delete a resource
TRACE, OPTIONS, LINK, UNLINK, PATCH
18@PeterHilton •
23. HTTP response status codes
100-199 Informational
200-299 Client request successful
300-399 Request redirected, further action necessary
400-499 Client error - do not repeat the same request
500-599 Server error - maybe try again
About 60 defined status codes
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes 23@PeterHilton •
24. HTTP header fields (‘HTTP headers’)
24@PeterHilton •
General headers are used in both request and response
Request headers indicate client preferences and config
Response headers provide information about the server
Entity headers describe the request or response body
Non-standard headers are application-specific
About 50 defined standard headers
https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
25. Things that everyone gets wrong
Character encodings
URL encoding/decoding
Caches and proxies
Cookies, and using them to introduce session state
25@PeterHilton •
26. Further reading
26@PeterHilton •
Web Client Programming with Perl (O’Reilly, 1997),
now available free online via O’Reilly Open Books,
starts with three well-written chapters that teach
everything web developers need to know about HTTP:
Chapter 1: Introduction
Chapter 2: Demystifying the Browser
Chapter 3: Learning HTTP
http://www.oreilly.com/openbook/webclient/