Chapter 9. HTTP

The protocols of yore tended to be dense, binary, and decipherable only by Boolean machine logic. But the workhorse protocol of the World Wide Web, named the Hypertext Transfer Protocol (HTTP), is instead based on friendly, mostly-human-readable text. There is probably no better way to start this chapter than to show you what an actual request and response looks like; that way, you will already know the layout of a whole request as we start digging into each of its features.

Consider what happens when you ask the urllib2 Python Standard Library to open this URL, which is the RFC that defines the HTTP protocol itself: www.ietf.org/rfc/rfc2616.txt

The library will connect to the IETF web site, and send it an HTTP request that looks ...

Get Foundations of Python Network Programming: The comprehensive guide to building network applications with Python, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.