http的请求协议

Posted nizuimeiabc1

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了http的请求协议相关的知识,希望对你有一定的参考价值。

技术图片

Http的Get,POST

Get请求包括两个部分:

  • request line(包括method,request uri,protocol version))
  • header

基本样式:

GET /?name=XXG&age=23 HTTP/1.1       -----> request line
------------------------------------------------------------------
Host: 127.0.0.1:8007
Connection: keep-alive              
Cache-Control: max-age=0             -----> header
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (Khtml, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9

POST请求包括三个部分

  • request line(包括method,request uri,protocol version))
  • header
  • message body

基本样式

GET / HTTP/1.1                       -----> request line
------------------------------------------------------------------
Host: 127.0.0.1:8007
Connection: keep-alive  
Content-Length: 15            
Cache-Control: max-age=0             -----> header
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
------------------------------------------------------------------
name=XXG&age=23                     ------>message body

链接:https://www.cnblogs.com/bihanghang/p/10218738.html

以上是关于http的请求协议的主要内容,如果未能解决你的问题,请参考以下文章

简单的 Javascript http 请求片段但不起作用

express开发上手记录(3)知识补充:http请求和响应

不支持/识别请求的 websocket 子协议时的 HTTP 响应代码

分享,HTTP协议错误代码大全

HTTP协议

HTTP协议