liveBook · Manning

HTTP

As explained in The Well-Grounded Python Developer: How the pros use Python and Flask

HTTP is the application-layer protocol that defines how clients and web servers exchange requests and responses.

HTTP is the application-layer protocol behind the web’s request/response model. A browser sends a request to a web server, which returns resources such as HTML, CSS, JavaScript, and images. This same pattern lets applications provide information to, and consume information from, systems across a network. section 8.1 section 12.6

HTTP is stateless: each request is complete and independent, and the server retains no memory of earlier transactions. The request therefore carries the information needed to construct its response. Repeating an identical request produces the same rebuilt response unless additional state information is added to the client-server exchange. section 8.1

A basic HTTP request identifies what to retrieve and where to send the request:

  • The method, such as GET, specifies the requested operation; GET retrieves a document at a path. section 6.3
  • The path identifies the resource, while the HTTP version identifies the protocol version used for the request. section 6.3
  • The Host header identifies the destination domain and may include a port; port 80 is the default for web servers when omitted. section 6.3
  • A domain name is translated by DNS into an IP address so network protocols can direct the request to the correct server. section 6.3

A browser request

When a browser requests a page, it can send “GET /path_part/index.html HTTP/1.1” together with “Host: fictional_website.com:80” and an Accept header. The server uses this information to locate the requested document and build a response. section 6.3

1 GET /path_part/index.html HTTP/1.1
2 Host: fictional_website.com:80
3 Accept: text/html, */*
4 <CR-LF>

Inspect the request line, destination header, accepted content types, and terminating line break as a compact HTTP example. section 6.3

How The Well-Grounded Python Developer: How the pros use Python and Flask covers it

How deep it goes
Explains statelessness and basic request fields, but deliberately stops short of a full protocol definition.
Examples
Uses a browser request for an HTML path with GET, HTTP/1.1, Host, Accept, domain, and port details.
What it assumes
Assumes familiarity with browsers, web servers, HTML, and basic networked applications.
What you can do after
Evaluate/understand how browsers identify resources and how servers construct responses without retained request history.
How it connects
Links HTTP with web servers, browsers, DNS, JavaScript, and the request/response model.

Also explained in

Compare how 8 books explain HTTP →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Well-Grounded Python Developer: How the pros use Python and Flask. The section links point to the parts of the book it draws on.