HTTP: The Definitive Guide (2024)

Just about all ofthe world’s HTTP communication is carried overTCP/IP,a popular layered set of packet-switched network protocols spoken bycomputers and network devices around the globe. A client applicationcan open a TCP/IP connection to a server application, running justabout anywhere in the world. Once the connection is established,messages exchanged between the client’s andserver’s computers will never be lost, damaged, orreceived out of order.[1]

Say you want the latest power tools price list fromJoe’s Hardware store:

http://www.joes-hardware.com:80/power-tools.html

When given this URL, your browser performs the steps shown in Figure 4-1. In Steps 1-3, the IP address and port numberof the server are pulled from the URL. A TCP connection is made tothe web server in Step 4, and a request message is sent across theconnection in Step 5. The response is read in Step 6, and theconnection is closed in Step 7.

HTTP: The Definitive Guide (1)

Figure4-1.Web browsers talk to web servers over TCP connections

TCP Reliable Data Pipes

HTTP connections really are nothingmore than TCP connections, plus a few rules about how to use them.TCP connections are the reliable connections of the Internet. To senddata accurately and quickly, you need to know the basics ofTCP.[2]

TCP gives HTTP a reliable bitpipe . Bytes stuffed in one side of a TCPconnection come out the other side correctly, and in the right order(see Figure 4-2).

TCP Streams Are Segmented and Shipped by IP Packets

TCP sends its data in little chunks called IPpackets (or IP datagrams).In this way, HTTP is the top layer in a"protocol stack” of“HTTP over TCP over IP,” asdepicted in Figure 4-3a. A secure variant,HTTPS, inserts acryptographic encryption layer (called TLS or SSL) between HTTP andTCP (Figure 4-3b).

HTTP: The Definitive Guide (3)

Figure4-3.HTTP and HTTPS network protocol stacks

When HTTP wants to transmit a message, it streams the contents of themessage data, in order, through an open TCP connection. TCP takes thestream of data, chops up the data stream into chunks calledsegments, andtransports the segments across the Internet inside envelopes calledIP packets (see Figure 4-4). This is all handled bythe TCP/IP software; the HTTP programmer sees none of it.

Each TCP segment is carried by an IP packet from one IP address to anotherIP address. Each of these IP packets contains:

  • An IP packet header (usually 20 bytes)

  • A TCP segment header (usually 20 bytes)

  • A chunk of TCP data (0 or more bytes)

The IP header contains the source and destination IP addresses, thesize, and other flags. The TCP segment header contains TCP portnumbers, TCP control flags, and numeric values used for data orderingand integrity checking.

See Also
TCP vs HTTP

HTTP: The Definitive Guide (4)

Figure4-4.IP packets carry TCP segments, which carry chunks of the TCP data stream

Keeping TCP Connections Straight

A computer might have several TCP connections open at any one time. TCPkeeps all these connections straight through portnumbers .

Port numbers are like employees’ phone extensions.Just as a company’s main phone number gets you tothe front desk and the extension gets you to the right employee, theIP address gets you to the right computer and the port number getsyou to the right application. A TCP connection is distinguished by fourvalues:

<source-IP-address, source-port, destination-IP-address, destination-port>

Together, these four values uniquely define a connection. Twodifferent TCP connections are not allowed to have the same values forall four address components (but different connections can have thesame values for some of the components).

In Figure 4-5, there are four connections: A, B, Cand D. The relevant information for each port is listed in Table 4-1.

Table4-1.TCP connection values

Connection

Source IP address

Source port

Destination IP address

Destination port

A

209.1.32.34

2034

204.62.128.58

4133

B

209.1.32.35

3227

204.62.128.58

4140

C

209.1.32.35

3105

207.25.71.25

80

D

209.1.33.89

5100

207.25.71.25

80

HTTP: The Definitive Guide (5)

Figure4-5.Four distinct TCP connections

Note that some of the connections share the same destination portnumber (C and D both have destination port 80). Some of theconnections have the same source IP address (B and C). Some have thesame destination IP address (A and B, and C and D). But no twodifferent connections share all four identical values.

Programming with TCP Sockets

Operating systems provide different facilities for manipulating theirTCP connections. Let’s take a quick look at one TCPprogramming interface, to make things concrete. Table 4-2 shows some of the primary interfaces providedby the sockets API. This sockets API hides all thedetails of TCP and IP from the HTTP programmer. The sockets API wasfirst developed for the Unix operating system, but variants are nowavailable for almost every operating system and language.

Table4-2.Common socket interface functions for programming TCP connections

Sockets API call

Description

s = socket(<parameters>)

Creates a new, unnamed, unattached socket.

bind(s, <local IP:port>)

Assigns a local port number and interface to the socket.

connect(s, <remote IP:port>)

Establishes a TCP connection to a local socket and a remote host andport.

listen(s,...)

Marks a local socket as legal to accept connections.

s2 = accept(s)

Waits for someone to establish a connection to a local port.

n = read(s,buffer,n)

Tries to read n bytes from the socket into the buffer.

n = write(s,buffer,n)

Tries to write n bytes from the buffer into the socket.

close(s)

Completely closes the TCP connection.

shutdown(s,<side>)

Closes just the input or the output of the TCP connection.

getsockopt(s, . . . )

Reads the value of an internal socket configuration option.

setsockopt(s, . . . )

Changes the value of an internal socket configuration option.

The sockets API lets you create TCPendpoint data structures, connect these endpoints to remote serverTCP endpoints, and read and write data streams. The TCP API hides allthe details of the underlying network protocol handshaking and thesegmentation and reassembly of the TCP data stream to and from IPpackets.

In Figure 4-1, we showed how a web browser coulddownload the power-tools.html web page fromJoe’s Hardware store using HTTP. The pseudocode inFigure 4-6 sketches how we might use the socketsAPI to highlight the steps the client and server could perform toimplement this HTTP transaction.

HTTP: The Definitive Guide (6)

Figure4-6.How TCP clients and servers communicate using the TCP sockets interface

We begin with the web server waiting for a connection (Figure 4-6, S4). The client determines the IP address andport number from the URL and proceeds to establish a TCP connectionto the server (Figure 4-6, C3). Establishing aconnection can take a while, depending on how far away the server is,the load on the server, and the congestion of the Internet.

Once the connection is set up, the client sends the HTTP request(Figure 4-6, C5) and the server reads it (Figure 4-6, S6). Once the server gets the entire requestmessage, it processes the request, performs the requested action(Figure 4-6, S7), and writes the data back to theclient. The client reads it (Figure 4-6, C6) andprocesses the response data (Figure 4-6, C7).


[1] Though messageswon’t be lost or corrupted, communication betweenclient and server can be severed if a computer or network breaks. Inthis case, the client and server are notified of the communicationbreakdown.

[2] If you are trying to write sophisticated HTTPapplications, and especially if you want them to be fast,you’ll want to learn a lot more about the internalsand performance of TCP than we discuss in this chapter. We recommendthe “TCP/IP Illustrated” books byW. Richard Stevens (Addison Wesley).

HTTP: The Definitive Guide (2024)

FAQs

Is HTTP the definitive guide still relevant? ›

This is should be a must-read for web developer. There are considerable sections of the book that is outdated now, but there are some other section that discuss core knowledge engineers who work with web should have. The best book I have ever read about HTTP.

What is an HTTP book? ›

Book overview

Behind every web transaction lies the Hypertext Transfer Protocol (HTTP) --- the language of web browsers and servers, of portals and search engines, of e-commerce and web services. Understanding HTTP is essential for practically all web-based programming, design, analysis, and administration.

Why is HTTP not used anymore? ›

In summary, HTTP is a protocol that is vulnerable to attacks, while HTTPS is a secure version of HTTP that uses encryption to protect data in transit.

Why is HTTP not good? ›

If a website uses HTTP instead of HTTPS, all requests and responses can be read by anyone who is monitoring the session. Essentially, a malicious actor can just read the text in the request or the response and know exactly what information someone is asking for, sending, or receiving.

What is HTTP for dummies? ›

HTTP (Hypertext Transfer Protocol) is a protocol used for exchanging information over the internet. HTTP is like the delivery system for information on the internet. It makes sure information goes from one place to another, like how ships carry goods across the ocean. It's the foundation of the World Wide Web.

What is HTTP in simple words? ›

The Hypertext Transfer Protocol (HTTP) is the foundation of the World Wide Web, and is used to load webpages using hypertext links. HTTP is an application layer protocol designed to transfer information between networked devices and runs on top of other layers of the network protocol stack.

Why is it called HTTP? ›

Tim Berners-Lee used a form of hypertext (HyperText Markup Language, or HTML) when designing the World Wide Web. The protocol used to carry HTML data with attendant directives was called the Hypertext Transfer Protocol.

Is HTTP still being used? ›

HTTP/3, the successor to HTTP/2, was published in 2022. As of February 2024, it is now used on 29% of websites and is supported by most web browsers, i.e. (at least partially) supported by 97% of users. HTTP/3 uses QUIC instead of TCP for the underlying transport protocol.

Will HTTP be deprecated? ›

HTTP deprecation does not mean that HTTP will cease to exist. HTTP sites will still be accessible to those who use either Chrome or Firefox, however, there will likely be changes to the visual security indicators for those sites. In both browsers, the visual indicators may show that HTTP sites are not secure.

Which HTTP version is the currently being used? ›

HTTP/3 - HTTP over QUIC

The next major version of HTTP, HTTP/3 has the same semantics as earlier versions of HTTP but uses QUIC instead of TCP for the transport layer portion. By October 2022, 26% of all websites were using HTTP/3.

Should you ever use HTTP? ›

The most significant problem with HTTP is it uses hypertext structured text, so the data isn't encrypted. As a result, the data being transmitted between the two systems can be intercepted by cybercriminals.

Top Articles
The Wash Sale Rule: Six Things You Need to Know
Top Daily Losses: US stocks posting the largest losses today - Yahoo Finance
English Bulldog Puppies For Sale Under 1000 In Florida
Katie Pavlich Bikini Photos
Gamevault Agent
Pieology Nutrition Calculator Mobile
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Compare the Samsung Galaxy S24 - 256GB - Cobalt Violet vs Apple iPhone 16 Pro - 128GB - Desert Titanium | AT&T
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Craigslist Dog Kennels For Sale
Things To Do In Atlanta Tomorrow Night
Non Sequitur
Crossword Nexus Solver
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Energy Healing Conference Utah
Geometry Review Quiz 5 Answer Key
Hobby Stores Near Me Now
Icivics The Electoral Process Answer Key
Allybearloves
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Marquette Gas Prices
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Vera Bradley Factory Outlet Sunbury Products
Pixel Combat Unblocked
Movies - EPIC Theatres
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Mia Malkova Bio, Net Worth, Age & More - Magzica
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Where Can I Cash A Huntington National Bank Check
Topos De Bolos Engraçados
Sand Castle Parents Guide
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hello – Cornerstone Chapel
Stoughton Commuter Rail Schedule
Nfsd Web Portal
Selly Medaline
Latest Posts
Article information

Author: Fr. Dewey Fisher

Last Updated:

Views: 5875

Rating: 4.1 / 5 (62 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Fr. Dewey Fisher

Birthday: 1993-03-26

Address: 917 Hyun Views, Rogahnmouth, KY 91013-8827

Phone: +5938540192553

Job: Administration Developer

Hobby: Embroidery, Horseback riding, Juggling, Urban exploration, Skiing, Cycling, Handball

Introduction: My name is Fr. Dewey Fisher, I am a powerful, open, faithful, combative, spotless, faithful, fair person who loves writing and wants to share my knowledge and understanding with you.