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

HTTP协议?HTTP报文组成(请求报文、响应报文) #21

Open
GGXXMM opened this issue Aug 11, 2019 · 0 comments
Open

HTTP协议?HTTP报文组成(请求报文、响应报文) #21

GGXXMM opened this issue Aug 11, 2019 · 0 comments
Labels

Comments

@GGXXMM
Copy link
Owner

GGXXMM commented Aug 11, 2019

HTTP协议

HTTP协议,即超文本传输协议(Hypertext transfer protocol)。是一种详细规定了浏览器和万维网(WWW = World Wide Web)服务器之间互相通信的规则,通过因特网传送万维网文档的数据传送协议。

HTTP报文

image

1、HTTP请求报文

  • 请求行
    包括请求方法、URI、HTTP版本
  • 请求头
    从客户端向服务器端发送请求报文时使用的首部。由关键字/值对组成,每行一对,关键字和值用英文冒号“:”分隔。
    image
    常用的Content-Type
Content-Type 解释
text/html html格式
text/plain 纯文本格式
text/css CSS格式
text/javascript js格式
image/gif gif图片格式
image/jpeg jpg图片格式
image/png png图片格式
application/x-www-form-urlencoded POST专用:普通的表单提交默认是通过这种方式。form表单数据被编码为key/value格式发送到服务器。
application/json POST专用:用来告诉服务端消息主体是序列化后的 JSON 字符串
text/xml POST专用:发送xml数据
multipart/form-data 用以支持向服务器发送二进制数据,以便可以在 POST 请求中实现文件上传等功能。
  • 空行
    CR回车符+LF换行符
  • 请求体
    应被发送的数据

2、HTTP响应报文

  • 响应行
    HTTP版本、状态码
  • 响应头
    image
  • 空行
    CR回车符+LF换行符
  • 响应体
    服务器返回的数据内容

image

@GGXXMM GGXXMM added the 网络 label Dec 7, 2021
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

1 participant