Skip to content

Instantly share code, notes, and snippets.

@firefirer1983
Created April 8, 2020 10:55
Show Gist options
  • Save firefirer1983/096a968d221924794935e40250269c71 to your computer and use it in GitHub Desktop.
Save firefirer1983/096a968d221924794935e40250269c71 to your computer and use it in GitHub Desktop.
Http组成部分

Http组成部分

请求报文格式:

	<method> <request-URL> <version>
    <headers>
    
    <entity-body>

响应报文格式:

	<version> <status> <reason-phrase>
    <headers>
    
    <entity-body>

所有HTTP报文都是以一个起始行(start-line)开始. 请求报文起始行说明要做什么 响应报文起始行说明发生了什么

HTTP方法

  • GET 从服务器获取一份文档
  • HEAD 只从服务器获取文档首部
  • POST 向服务器发送需要处理的数据
  • PUT 将请求的主体部分存储在服务器上
  • DELETE 从服务器上删除一份文档
  • OPTIONS 决定可以在服务器上执行那些方法
  • TRACE 对可能经过代理服务器传送到服务器上去的报文进行追踪

状态码分类

  • 100~101 信息提示
  • 200~206 成功
  • 300~305 重定向
  • 400~415 客户端错误
  • 500~505 服务器错误
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment