HTTP 请求
一个HTTP请求包括三个组成部分:
方法—统一资源标识符(URI)—协议/版本
请求的头部
主体内容
下面是一个HTTP请求的例子:
POST /examples/default.jsp HTTP/1.1
Accept: text/plain; text/html
Accept-Language: en-gb
Connection: Keep-Alive
Host: localhost
User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows 98)
Content-Length: 33
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
一个HTTP请求包括三个组成部分:
方法—统一资源标识符(URI)—协议/版本
请求的头部
主体内容
下面是一个HTTP请求的例子:
POST /examples/default.jsp HTTP/1.1
Accept: text/plain; text/html
Accept-Language: en-gb
Connection: Keep-Alive
Host: localhost
User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows 98)
Content-Length: 33
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
lastName=Franks&firstName=Michael
HTTP 响应
类似于HTTP请求,一个HTTP响应也包括三个组成部分:
方法—统一资源标识符(URI)—协议/版本
响应的头部
主体内容
下面是一个HTTP响应的例子:
HTTP/1.1 200 OK
Server: Microsoft-IIS/4.0
Date: Mon, 5 Jan 2004 13:13:33 GMT
Content-Type: text/html
Last-Modified: Mon, 5 Jan 2004 13:13:12 GMT
Content-Length: 112
<html>
<head>
<title>HTTP Response Example</title>
</head>
<body>
Welcome to Brainy Software
</body>
</html>
本文详细解析了HTTP请求与响应的基本组成结构,并通过具体实例展示了请求与响应的构造方式。介绍了一个HTTP请求由方法、URI、协议/版本、请求头部及主体内容构成;而HTTP响应则包括状态行、响应头部及主体内容。
&spm=1001.2101.3001.5002&articleId=7548762&d=1&t=3&u=569592d745714019b9c6723fea658e38)

被折叠的 条评论
为什么被折叠?



