http 请求报文与响应报文

本贴最后更新于 2337 天前,其中的信息可能已经沧海桑田

请求报文

第一部分:请求行(请求资源地址)

1. POST /examples/default.jsp HTTP/1.1

  1. POST(Method 请求方法)
  2. /examples/default.jsp(URI:Uniform Resource Identifier 统一资源标识符)
  3. HTTP(Protocol 协议)/1.1(Version 版本)

第二部分:请求头(Request headers)

2. Accept: text/plain; text/html

  1. 告诉服务端,客户端能接受什么类型的响应,例子中的报文头表示客户端只能接收纯文本和 html,如果服务端放回图片视频什么的,就接收不了
3. Accept-Language: en-gb 4. Connection: Keep-Alive 5. Host: localhost 6. User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows 98) 7. Content-Length: 33 8. Content-Type: application/x-www-form-urlencoded 9. Accept-Encoding: gzip, deflate

第三部分:请求体(Entity body)

10. lastName=Franks&firstName=Michael

响应报文

第一部分:响应行

1. HTTP/1.1 200 OK

  1. HTTP(Protocol 协议)/1.1(Version 版本)
  2. 200(Status code)
  3. OK(Description)

第二部分:响应头

2. Server: Microsoft-IIS/4.0 3. Date: Mon, 5 Jan 2004 13:13:33 GMT 4. Content-Type: text/html 5. Last-Modified: Mon, 5 Jan 2004 13:13:12 GMT 6. Content-Length: 112

第三部分:响应体

8. <html> 9. <head> 10. HTTP Response Example 11. </head> 12. <body> 13. Welcome to Brainy Software 14. </body> 15. </html>
  • 网络
    140 引用 • 184 回帖 • 4 关注

相关帖子

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...