liveBook · Manning

HTTP

As explained in Rust in Action: Systems programming concepts and techniques

HTTP (Hypertext Transfer Protocol) is an application-layer protocol for exchanging requests and responses between clients and servers.

HTTP, the application-layer protocol understood by web frameworks, transports HTML, CSS, JavaScript, WebAssembly modules, images, video, and other content between networked systems. Understanding it helps tune framework performance and diagnose problems. section 8.1

HTTP operates within layered networking. Lower layers pass byte streams upward without knowing their meaning, while higher layers remain largely agnostic about how messages travel. TCP carries HTTP, and TLS sits between them to provide encrypted messaging for HTTPS. section 8.1

Figure 8.2 Several layers of networking protocols involved with delivering content over the internet. The figure compares some common models, including the seven-layer OSI model and the four-layer TCP/IP model.

Use the networking-layer figure to compare the OSI and TCP/IP models and locate HTTP among the protocols delivering internet content. section 8.1

A raw HTTP client can be assembled by coordinating several network operations:

  • Resolve a domain name to an IP address with DNS. section 8.10
  • Create and manage a TCP connection through smoltcp primitives. section 8.10
  • Progress through connection, request, and response states. section 8.10
  • Coordinate command-line parsing, URL handling, Ethernet setup, DNS, and HTTP code in the mget project. section 8.10

mget: a manually built web client

The mget command accepts a URL and tap device, optionally accepts a DNS server, resolves the domain, configures Ethernet support, and performs an HTTP request without relying on a high-level web framework. section 8.10

ch8-mget
├── Cargo.toml          #1
└── src
    ├── main.rs         #2
    ├── ethernet.rs     #3
    ├── http.rs         #4
    └── dns.rs          #5

Browse the mget file tree to see how command-line coordination, Ethernet handling, HTTP interaction, and DNS resolution are separated into modules. section 8.10

How Rust in Action: Systems programming concepts and techniques covers it

How deep it goes
Explains HTTP within layered networking and builds a raw TCP client, including connection, request, and response states.
Examples
Demonstrates HTTP through the Rust mget client, its modular project tree, and a state-driven TCP request implementation.
What it assumes
Assumes familiarity with web programming, then introduces networking layers and the roles of TCP, TLS, DNS, and Ethernet.
What you can do after
Builds a manually operated HTTP client that resolves domains and exchanges requests through TCP-level networking primitives.
How it connects
Connects HTTP with web frameworks, TCP, TLS, HTTPS, DNS, Ethernet, and URL handling.

Also explained in

Compare how 8 books explain HTTP →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Rust in Action: Systems programming concepts and techniques. The section links point to the parts of the book it draws on.