Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Q110】http 的请求报文与响应报文的格式是什么 #111

Open
shfshanyue opened this issue Dec 10, 2019 · 2 comments
Open

【Q110】http 的请求报文与响应报文的格式是什么 #111

shfshanyue opened this issue Dec 10, 2019 · 2 comments
Labels

Comments

@shfshanyue
Copy link
Owner

No description provided.

@shfshanyue shfshanyue changed the title 【Q110】http 的请求报文与相应报文的格式是什么 【Q110】http 的请求报文与响应报文的格式是什么 Dec 10, 2019
@shfshanyue
Copy link
Owner Author

shfshanyue commented Dec 10, 2019

nc 模拟 http 报文如下

$ nc www.baidu.com 80
GET / HTTP/1.1
Host: www.baidu.com

HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: no-cache
Connection: Keep-Alive
Content-Length: 14615
Content-Type: text/html
Date: Tue, 10 Dec 2019 02:48:44 GMT
P3p: CP=" OTI DSP COR IVA OUR IND COM "
P3p: CP=" OTI DSP COR IVA OUR IND COM "
Pragma: no-cache
Server: BWS/1.1
Set-Cookie: BAIDUID=F0FC6B3A056DEA285F51A1F2F8A170BB:FG=1; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
Set-Cookie: BIDUPSID=F0FC6B3A056DEA285F51A1F2F8A170BB; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
Set-Cookie: PSTM=1575946124; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
Set-Cookie: BAIDUID=F0FC6B3A056DEA287CB2B9422E09E30E:FG=1; max-age=31536000; expires=Wed, 09-Dec-20 02:48:44 GMT; domain=.baidu.com; path=/; version=1; comment=bd
Traceid: 1575946124058431156210725656341129791126
Vary: Accept-Encoding
X-Ua-Compatible: IE=Edge,chrome=1

<!DOCTYPE html><!--STATUS OK-->
........内容省略

GET 请求报文如下:

POST 请求报文如下:

@Echo-MakeGreatEffort
Copy link

请求报文:

  1. 请求行:<方法><请求目标><http协议版本>
  2. 请求头:<头部字段名>: <值>
  3. 空行
  4. 请求体

响应报文:

  1. 状态行:<HTTP版本> <状态码> <原因短语>
  2. 响应头部:<头部字段名>: <值>
  3. 空行
  4. 响应体

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants