File tree Expand file tree Collapse file tree 2 files changed +71
-1
lines changed Expand file tree Collapse file tree 2 files changed +71
-1
lines changed Original file line number Diff line number Diff line change
1
+ # HTTP 请求消息
2
+
3
+ ## 请求行 Request Line:
4
+
5
+ 第一行叫` 请求行 ` ,请求行的语法是: ` request-method-name request-URI HTTP-version `
6
+
7
+ request-method-name: http 请求定义了一些请求方法,例如: GET,POST,HEAD,OPTIONS
8
+
9
+ request-URI:指定请求的资源
10
+
11
+ HTTP-version:现在有两个版本正在使用: HTTP/1.0 and HTTP/1.1
12
+
13
+ 例如以下都是请求行:
14
+ ```
15
+ GET /test.html HTTP/1.1
16
+ HEAD /query.html HTTP/1.0
17
+ POST /index.html HTTP/1.1
18
+ ```
19
+
20
+
21
+ ## 请求头 Request Headeers
22
+
23
+ 请求头以` 名称:值 ` 的形式出现,可以有多个值,用逗号分割
24
+
25
+ 例如:
26
+ ```
27
+ Host: www.xyz.com
28
+ Connection: Keep-Alive
29
+ Accept: image/gif, image/jpeg, */*
30
+ Accept-Language: us-en, fr, cn
31
+ ```
32
+
33
+ # HTTP 响应消息
34
+
35
+ ## 状态行 Status Line
36
+
37
+ 第一行叫` 状态行 ` ,状态行的语法是:
38
+ ` HTTP-version status-code reason-phrase `
39
+
40
+ HTTP-version: HTTP 版本号
41
+
42
+ status-code: 3 位数的状态码
43
+
44
+ reason-phrase: 对状态码的简短解释
45
+
46
+ 例如以下都是状态行:
47
+ ```
48
+ HTTP/1.1 200 OK
49
+ HTTP/1.0 404 Not Found
50
+ HTTP/1.1 403 Forbidden
51
+ ```
52
+ ## 响应头 Reponse Header
53
+
54
+ 与请求头一样,响应头也是以` 名称:值 ` 的形式出现,可以有多个值,用逗号分割
55
+
56
+ 以下是例子:
57
+ ```
58
+ Content-Type: text/html
59
+ Content-Length: 35
60
+ Connection: Keep-Alive
61
+ Keep-Alive: timeout=15, max=100
62
+ ```
63
+
64
+ # HTTP 请求方法
65
+
66
+ ## GET
67
+
68
+ GET 是最常见的 HTTP 请求方法,客户端可以使用 GET 请求方法来从 HTTP 服务器请求一些资源
69
+
70
+ 在请求行中大小写敏感,所以必须是大写的 ` GET `
Original file line number Diff line number Diff line change 16
16
17
17
## [ Other ] ( )
18
18
19
- [ HTTP ] ( )
19
+ [ HTTP ] ( ./Other/http.md )
You can’t perform that action at this time.
0 commit comments