首页 > Web开发 > 详细

HTTP/1.1_RFC2616

时间:2019-07-16 00:33:57      阅读:98      评论:0      收藏:0      [点我收藏+]

HTTP/1.1及之前

HTTP(超文本传输协议)是应用层的协议,最初的HTTP/0.9是一个允许原始数据传输的简单协议,HTTP/1.0则允许MIME类型格式,且包含request/respone语义,然而HTTP/1.0并没有充分考虑到分层,在代理,缓存,持久连接和虚拟主机,所以催生出新版本的HTTP/1.1实现了以上功能。HTTP/1.1与之前版本一个很大的不同就在于HTTP连接默认为持久连接,在HTTP/1.0中,没有Keep-Alive规范,如果客户端支持Keep-Alive,则会在HTTP请求头中添加Connection:Keep-Alive字段。支持持久连接的客户端,可以Pipeline它的请求(也就是发送多个request而不用等待每个respone),而服务器必须按照收到请求的顺序按序发送响应

GET与POST

安全方法

规定GET和HEAD只取回数据而不修改数据,因此是安全的;POST,PUT,DELETE则相反

幂等方法

多个相同请求的副作用和单个请求的副作用一样,则称其为幂等的,如GET,HEAD,PUT,DELETE,而OPTIONS和TRACE没有副作用,因此是天然幂等的,然而也有可能一个请求序列中的所有请求是幂等的,但是这个序列不是幂等的(序列幂等定义与单个请求类似)

GET

条件GET,部分GET,当且仅当满足HTTP caching的要求时,GET请求的响应是cacheable

POST

POST会发两次包,两个响应,一个响应是100,一个响应是真正的数据

附录:响应码及说明

  • 1xx: Informational - Request received, continuing process
  • 2xx: Success - The action was successfully received,
    understood, and accepted

  • 3xx: Redirection - Further action must be taken in order to
    complete the request

  • 4xx: Client Error - The request contains bad syntax or cannot
    be fulfilled

  • 5xx: Server Error - The server failed to fulfill an apparently
    valid request

"100" ; Section 10.1.1: Continue
"101" ; Section 10.1.2: Switching Protocols
"200" ; Section 10.2.1: OK
"201" ; Section 10.2.2: Created
"202" ; Section 10.2.3: Accepted
"203" ; Section 10.2.4: Non-Authoritative Information
"204" ; Section 10.2.5: No Content
"205" ; Section 10.2.6: Reset Content
"206" ; Section 10.2.7: Partial Content
"300" ; Section 10.3.1: Multiple Choices
"301" ; Section 10.3.2: Moved Permanently
"302" ; Section 10.3.3: Found
"303" ; Section 10.3.4: See Other
"304" ; Section 10.3.5: Not Modified
"305" ; Section 10.3.6: Use Proxy
"307" ; Section 10.3.8: Temporary Redirect
"400" ; Section 10.4.1: Bad Request
"401" ; Section 10.4.2: Unauthorized
"402" ; Section 10.4.3: Payment Required
"403" ; Section 10.4.4: Forbidden
"404" ; Section 10.4.5: Not Found
"405" ; Section 10.4.6: Method Not Allowed
"406" ; Section 10.4.7: Not Acceptable
"407" ; Section 10.4.8: Proxy Authentication Required
"408" ; Section 10.4.9: Request Time-out
"409" ; Section 10.4.10: Conflict
"410" ; Section 10.4.11: Gone
"411" ; Section 10.4.12: Length Required
"412" ; Section 10.4.13: Precondition Failed
"413" ; Section 10.4.14: Request Entity Too Large
"414" ; Section 10.4.15: Request-URI Too Large
"415" ; Section 10.4.16: Unsupported Media Type
"416" ; Section 10.4.17: Requested range not satisfiable
"417" ; Section 10.4.18: Expectation Failed
"500" ; Section 10.5.1: Internal Server Error
"501" ; Section 10.5.2: Not Implemented
"502" ; Section 10.5.3: Bad Gateway
"503" ; Section 10.5.4: Service Unavailable
"504" ; Section 10.5.5: Gateway Time-out
"505" ; Section 10.5.6: HTTP Version not supported

HTTP/1.1_RFC2616

原文:https://www.cnblogs.com/qbits/p/11192401.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!