📘
Deuterium Wiki
  • Hello
  • Linux
    • cmd
      • du: 显式文件大小
      • seq: 生成序列
      • cat: 连接
      • cp: 复制
      • cd: 切换目录
      • mv: 移动
    • awk
      • 执行awk脚本
      • 删除空行
      • 个数统计
      • 文件的交集
      • 文件的差集
    • mysql
      • 删除重复数据
      • 导出数据不带标题
  • Reading
    • Novel
      • 《基督山伯爵》人物关系
    • Awesome CS Books
      • csapp-3e-homework-solution
        • 1. A Tour of Computer Systems
        • 2. Representing and Manipulating Information
          • 2.55 Compile and Run
          • 2.56 Another Try
          • 2.57 More show Procedures
          • 2.58 Check Little-Endian
          • 2.59 Bit Expressions
          • 2.60 Replace Byte
          • 2.61 More Bit Expressions
          • 2.62 Check Arithmetic Right Shift
          • 2.63 Logic & Arithmetic Right Shift
          • 2.64 Any Odd One
          • 2.65 Odd Ones
          • 2.66 Leftmost One
          • 2.67 Int Size is 32
          • 2.68 Lower One Mask
          • 2.69 Rotate Left
          • 2.70 Fits Bits
          • 2.71 Xbyte
          • 2.72 Copy Int
          • 2.73 Saturating Add
          • 2.74 Sub OK
          • 2.75 Unsigned High Prod
          • 2.76 calloc
          • 2.77 Multiple By Shifts
          • 2.78 Divide Power 2
          • 2.79 Mul3div4
          • 2.80 Three Fourths
          • 2.81 Generate Bits
          • 2.82 Signed and Unsigned
          • 2.83 Binary Floating Value
          • 2.84 Float Le
          • 2.85 Floating Point I
          • 2.86 Extend Precision
          • 2.87 Floating-Point II
          • 2.88 Floating-Point III
          • 2.89 Floating-Point IV
          • 2.90 fpwr2
          • 2.91 π
          • 2.92 Float Negate
          • 2.93 Float Absval
          • 2.94 Float Twice
          • 2.95 Float Half
          • 2.96 Float f2i
          • 2.97 Float i2f
        • 3. Machine-Level Representation of Programs
          • 3.58 Decode
          • 3.59 128-bit Multiply
          • 3.60 For Loop
          • 3.61 Conditional Data Transfer
          • 3.62 Switch I
          • 3.63 Switch II
          • 3.64 Multiple Dimension Array I
          • 3.65 Multiple Dimension Array II
          • 3.66 Multiple Dimension Array III
          • 3.67 Caller and Callee
          • 3.68 Alignment
          • 3.69 Struct
          • 3.70 Union
          • 3.71 fgets
          • 3.72 Variable-Size Stack
          • 3.73 Find Range I
          • 3.74 Find Range II
          • 3.75 Complex
      • tcpv1
        • ch01: Introduction
        • ch02: Link Layer
        • ch03: Internet Protocol
        • ch04: Address Resolutin Protocol
        • ch05: Reverse Address Resolution Protocol
        • ch06: Internet Control Message Protocol
        • ch07: Ping Program
        • ch08: Traceroute Program
        • ch09: IP Routing
        • ch10: Dynamic Routing Protocols
        • ch11: User Datagram Protocol
        • ch12: Broadcasting and Multicasting
        • ch13: Internet Group Management Protocol
        • ch14: The Domain Name System
        • ch15: Trivial File Transfer Protocol
        • ch16: Boostrap Protocol
        • ch17: Transmission Control Protocol
        • ch18: TCP Connection Establishment and Termination
        • ch 19: TCP Interactive Data Flow
        • ch20: TCP Bulk Data Flow
      • http
        • ch01: Overview of HTTP
        • ch02: URLs and Resources
        • ch03: HTTP Messages
        • ch04: Connection Management
        • ch05: Web Servers
        • ch06: Proxies
        • ch07: Caching
        • ch08: Integration Points
        • ch09: Web Robots
        • ch10: HTTP-NG
        • ch11: Client Identification and Cookies
        • ch12: Basic Authentication
        • ch13: Digest Authentication
        • ch14: Secure HTTP
        • ch15: Entities and Encodings
        • ch16: Internationalizated
        • ch17: Content Negotiation and Transcoding
        • ch18: Web Hosting
        • ch19: Publishing Systems
        • ch20: Redirections and Load Balancing
        • ch21: Logging and Usage Tracking
    • 提升认知
      • 《为什么需要生物学思维》
      • 《大话西方艺术史》
  • Mathematics
Powered by GitBook
On this page
  • 0. Guide:
  • 1. Web Clients and Servers
  • 2. Resources
  • 2.1 Media Types
  • 2.2 URIs
  • 2.3 URLs
  • 2.4 URNs
  • 3. Transactions
  • 3.1 Methods
  • 3.2 Status Codes
  • 3.3 Web Pages Can Consist of Multiple Objects
  • 4. Message
  • 5. Connections
  • 5.1 Connections, IP Addresses, and Port Numbers
  • 6. Architectural Components of the Web
  • 6.1 Proxies
  • 6.2 Caches
  • 6.3 Gateways
  • 6.4 Tunnels
  • 6.5 Agents

Was this helpful?

  1. Reading
  2. Awesome CS Books
  3. http

ch01: Overview of HTTP

PrevioushttpNextch02: URLs and Resources

Last updated 4 years ago

Was this helpful?

1.HTTP概述

0. Guide:

  • How web clients and servers communicate

  • Where resources(web content) come from

  • How web transactions work

  • The format of the messages used for HTTP communication

  • The underlying TCP network transport

  • The different variations of the HTTP protocol

  • Some of the many HTTP architectural componenets installed around the Internet

1. Web Clients and Servers

Together, HTTP clients and HTTP servers make up the basic components of the World Wide Web.

2. Resources

A resource is any kind of content.

2.1 Media Types

Because the Internet hosts many thousands of different data types, HTTP carefully tags each object being transported through the Web with a data format label called a MIME type.

A MIME type is a textual label, represented as a primary obejct type and a specific subtype, separated by a slash. For example:

  • An HTML-formatted text document would be labeled with type text/html.

  • A plain ASCII text document would be labeled with type text/plain.

  • A JPEG version of an image would be image/jpeg.

  • A GIG-format impage would be image/gif.

  • An Apple QuickTime movie would be video/quicktime.

  • A Microsoft PowerPoint presentation would be application/vnd.ms-powerpoint.

2.2 URIs

Each web server resource has a name, so clients can point out what resources they are interested in.

The server resource name is called a uniform resource identifier, or URI:

URIs come in two flavors, called URLs and URNs.

2.3 URLs

URL(uniform resource locator) is the most common form of resource identifier.

URLs describe the specific location of a resource on a particular server.

Standardized format:

  • 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.joe-hardware.com).

  • The rest names a resource on the web server(e.g. /specials/saw-blade.gif).

Today, almost every URI is a URL.

2.4 URNs

URN(uniform resource name), servers unique name for a particular piece of content, independent of where the resource currently resides.

URNs are still experimental and not yet widely adopted.

3. Transactions

An HTTP transaction consists of a request command(sent from client to server), and a response result(sent from the server back to the client).

This communication happens with formatted blocks of data called HTTP messages:

3.1 Methods

Every HTTP request message has method. The method tells the server what action to perform:

HTTP method

Description

GET

Send named resource from the server to client.

PUT

Store data from client into a named server resource.

DELETE

Delete the named resource from a server.

POST

Send client data into a server gateway application.

HEAD

Send just the HTTP headers from the response for the named resource.

3.2 Status Codes

Every HTTP response message comes back with a status code.

HTTP also sends an explanatory textual "reason phrase" with each numeric status code.

3.3 Web Pages Can Consist of Multiple Objects

An application often issues multiple HTTP transactions to accomplish a task:

4. Message

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 arbitary binary data. Of course, the body can also contain text.

5. Connections

5.1 Connections, IP Addresses, and Port Numbers

Steps:

  1. The browser extracts the server's hostname from the URL.

  2. The browser converts the server's hostname into the server/s IP address.

  3. The browser extracts the port number(if any) from the URL.

  4. The browser establishes a TCP connection with the web server.

  5. The browser sends an HTTP request message to the server.

  6. The server sends an HTTP response back to the browser.

  7. The connection is closed, and the browser displays the document.

6. Architectural Components of the Web

There are many other web applications that you interact with on the Internet.

  • Proxies: HTTP intermediaries that sit between clients and servers

  • Caches: HTTP storehouses that keep copies of popular web pages close to clients

  • Gateways: Special web servers that connect to other applications

  • Tunnels: Special proxies that blindly forward HTTP communications

  • Agents: Semi-intelligent web clients that make automated HTTP requests

6.1 Proxies

Proxt servers, important building blocks for web security, application integration, and performance optimizaiton.

6.2 Caches

Web cache or caching proxy is a special type of HTTP proxy server that keeps copies of popular documents that pass through the proxy:

6.3 Gateways

Gateways are special servers that act as intermediaries for other servers. They are often used to convert HTTP traffic to another protocol:

6.4 Tunnels

Tunnels are HTTP applications that, after setup, blindly relay raw data between two connections.

6.5 Agents

Agents are client programs that make HTTP requests on the user's behalf. Any application that issues web requests is an HTTP agent:

Web clients and servers

Web servers host web resources:

Web servers attach a MIME type to all HTTP object data:

URLs specify protocol, server, and local resource
HTTP transactiosn consist of request and response messages

An example:

One popular use of HTTP tunnels is to carry encrypted Secure Sockets Layer traffic through an HTTP connection:

A web resource is anything that provides web content
MIME types are sent back with the data content