HTTP request (request line, a request header, the request body) and the response message (status code in response to the first response member)

"Log HTTP request message (request line, a request header, the request body) and the response message (status code in response to the first response member)"

Request line

eg
image
mainly includes: request method, request URL, HTTP protocol and version

Request header

eg
image
explain:

  • Accept: current media tells the server to accept the type of browser and processing * / * Indicates that all types.
  • Accept-Encoding: tell the server content encoding of the current browser supports.
  • Accept-Language: current browser tells the server to accept and process language. zh-CN above request, zh; q = 0.8 represents the degree of user preference for zh-CN was 80%.
  • Connection: keep-alive, tells the server in response to this request after the completion of maintaining the TCP connection is not released, waiting for the subsequent request for this connection. This can reduce the number of open TCP connections closed improve processing performance. Further options are Close, showed directly after reception complete response directly to close it.
  • Content-Length: length HTTP message transmission is used to describe entities.
  • Content-Type: content type, encoding type used to define the network and Web files, the browser will decide what form, what code reading this document.
常见的媒体格式类型如下:
text/html : HTML格式
text/plain :纯文本格式
text/xml : XML格式
image/gif :gif图片格式
image/jpeg :jpg图片格式
image/png:png图片格式
    
以application开头的媒体格式类型:
application/xhtml+xml :XHTML格式
application/xml: XML数据格式
application/atom+xml :Atom XML聚合格式
application/json: JSON数据格式
application/pdf:pdf格式
application/msword : Word文档格式
application/octet-stream : 二进制流数据(如常见的文件下载)
application/x-www-form-urlencoded : <form encType=””>中默认的encType,form表单数据被编码为key/value格式发送到服务器(表单默认的提交数据的格式)

另外一种常见的媒体格式是上传文件之时使用的:
multipart/form-data : 需要在表单中进行文件上传时,就需要使用该格式
  • Cookie: represents server-based visit assigned a Session ID, the Session ID will take the initiative each time a request is made using Cookie field and back to the server to verify its identity and hold.
  • Host: request destination description to be transmitted, this information will be contained in any type of request.
  • Origin: Request for where launched.
  • Referer: Specifies the source address of the originating request. According to the value server can track basic information about visitors. For example, we search in Baidu keyword Home Park blog, and access from the search results, the blog site server park can be traced to the value of Referer Visitors address: https://www.baidu.com/link?url...7c64da001b54df000000065e06ec91 so you can know visitors which is accessible from this website. If the visitor Referer is empty, there are two possibilities, one is a visitor modified request, delete the value of the Referer field, while another is that visitors visit the site URL directly in the address bar enter the address.
  • TE: What transmission coding used.
  • User-Agent: provides a browser type and version you are using to access the site, the identification information of the operating system and version, browser kernel and so on.
  • X-Requested-With: Ajax request is a request for determination or other requests.

Request body

  • POST request to pass data through the request body, by param1 = value1 & param2 = value2 form of key-value coding.
  • GET requests to pass data through the URL address parameters, that is, we usually see URL address inside "?" Key contained behind right.

status code

1XX:参考信息
2XX:状态成功
3XX:用于重定向
4XX:客户端错误
5XX:服务器端错误

Response header

eg
image

  • content-encoding: encoding format of the response
  • content-type: the type of response content
  • Response Time: date. As used herein, are GMT Standard Time
  • server: The use of the processing of the request source server software information
  • strict-transport-security:
HTTP Strict Transport Security(通常简称为HSTS)是一个安全功能,它告诉浏览器只能通过HTTPS访问当前资源, 禁止HTTP方式。

Max-age = 2592000 above response is shown in the next 30 days (i.e., 2,592,000 seconds), when the browser sends a request, initiates the connection must be HTTPS. If the user clicks on a hyperlink or in the address bar 'input http://www.example.com/ ', the browser should automatically turn http written https, and then directly to the ' https://www.example.com/ ' send request .

  • vary: inform downstream proxy server, how should future requests protocol header match to decide whether to use the content cached response instead of re-request new content from the origin server.

Response Body

In response body is returned by the server HTML pages or json data

Guess you like

Origin www.cnblogs.com/wdana/p/12112040.html