我的站点

一个系统软件工程师的随手涂鸦

Category: 《HTTP:The Definitive Guide》笔记

《HTTP:The Definitive Guide》笔记(4)—— The flow of messages

(1)

HTTP uses the terms inbound and outbound to describe transactional direction. Messages travel inbound to the origin server, and when their work is done, they travel outbound back to the user agent.

Capture

(2)

HTTP messages flow like rivers. All messages flow downstream, regardless of whether they are request messages or response messages. The sender of any message is upstream of the receiver. In following figure, proxy 1 is upstream of proxy 3 for the request but downstream of proxy 3 for the response.

Capture

 

《HTTP:The Definitive Guide》笔记(3)—— Web component

(1)Proxy:HTTP intermediaries that sit between clients and servers.A proxy sits between a client and a server, receiving all of the client’s HTTP requests and relaying the requests to the server (perhaps after modifying the requests). These applications act as a proxy for the user, accessing the server on the user’s behalf.

Capture

(2)Cache:A web cache or caching proxy is a special type of HTTP proxy server that keeps copies of popular documents that pass through the proxy. The next client requesting the same document can be served from the cache’s personal copy.

Capture

(3)Gateways:Gateways are special servers that act as intermediaries for other servers. They are often used to convert HTTP traffic to another protocol. A gateway always receives requests as if it was the origin server for the resource. The client may not be aware it is communicating with a gateway.

Capture

(4)Tunnels:Special proxies that blindly forward HTTP communications.Tunnels are HTTP applications that, after setup, blindly relay raw data between two connections. HTTP tunnels are often used to transport non-HTTP data over one or more HTTP connections, without looking at the data.

Capture

(5)Agents:Semi-intelligent web clients that make automated HTTP requests.User agents (or just agents) are client programs that make HTTP requests on the user’s behalf. Any application that issues web requests is an HTTP agent.

Capture

 

 

《HTTP:The Definitive Guide》笔记(2)—— messages

HTTP messages are simple, line-oriented sequences of characters. Because they are plain text, not binary, they are easy for humans to read and write.

HTTP messages sent from web clients to web servers are called request messages. Messages from servers to clients are called response messages. There are no other kinds of HTTP messages. The formats of HTTP request and response messages are very similar.

HTTP messages consist of three parts:

Start line
The first line of the message is the start line, indicating what to do for a request or what happened for a response.

Header fields
Zero or more header fields follow the start line. Each header field consists of a name and a value, separated by a colon (:) for easy parsing. The headers end with a blank line. Adding a header field is as easy as adding another line.

Body
After the blank line is an optional message body containing any kind of data. Request bodies carry data to the web server; response bodies carry data back to the client. Unlike the start lines and headers, which are textual and structured, the body can contain arbitrary binary data (e.g., images, videos, audio tracks, software applications). Of course, the body can also contain text.

 

Capture

《HTTP:The Definitive Guide》笔记(1)—— URI和URL

The server resource name is called a uniform resource identifier, or URI. URIs are like the postal addresses of the Internet, uniquely identifying and locating information resources around the world. URIs come in two flavors, called URLs and URNs.

The uniform resource locator (URL) is the most common form of resource identifier, and URLs come in two flavors: absolute and relative.
Most URLs follow a standardized format of three main parts:
• The first part of the URL is called the scheme, and it describes the protocol used to access the resource. This is usually the HTTP protocol (http://).
• The second part gives the server Internet address (e.g., www.joes-hardware.com).
• The rest names a resource on the web server (e.g., /specials/saw-blade.gif).
Today, almost every URI is a URL.

The second flavor of URI is the uniform resource name, or URN. A URN serves as a unique name for a particular piece of content, independent of where the resource currently resides. These location-independent URNs allow resources to move from place to place. URNs also allow resources to be accessed by multiple network access protocols while maintaining the same name.

 

Capture

Powered by WordPress & Theme by Anders Norén