An explanation of each parameter of the HTTP protocol

Source: Internet
Author: User

HTTP messages are made up of plain ASCII text. Messages include the message header and the Data Body section. The message header is in the behavior unit, each line ends with CRLF (carriage return and line wrapping), and after the end of the message header, an additional CRLF is added, and then the content is part of the data body.

HTTP request:

Examples are as follows:

get/sample.jsphttp/1.1accept:image/gif.image/jpeg,*/*ACCEPT-LANGUAGE:ZH-CNconnection:keep-aliveHost:localhostuser-agent:mozila/4.0 (compatible; MSIE5.01; Window NT5.0)accept-encoding:gzip,deflate username=jinqiao&password=1234

Request Mode (Requestmethod):options,GET,HEAD, POST, PUT, DELETE, Trace, and connect.

Get request gets the resource identified by the Request-uri
Post appends new data to the resource identified by Request-uri
HEAD request Gets the response message header for the resource identified by Request-uri
PUT Request server stores a resource and uses Request-uri as its identity
Delete Request server deletes the resource identified by the Request-uri
TRACE requests the server to echo received request information, primarily for testing or diagnostics
CONNECT reserved for future use
Options request the performance of the query server, or query for resource-related choices and requirements

user-agent:The browser information for the client. Connection:close indicates that a short connection is used, and keep-alive indicates that the client supports persistent connections. Date:the current time that the message was generated. Accept-language:the language supported by the client. Cache-controLwhether the client supports cache. No-cache indicates that the client does not support cache, such as max-age=3600, to tell the user Agent how long the response of the request is valid, within the validity period, and when the user needs access again, it is extracted locally from the client and does not require access to the server. Referer:Referer is used to tell the server which URL the request came from, which can be used to track the user's Web Access path. if-modified-since:If the request message contains a If-modified-since header field, the syntax of the GET method becomes conditional get, which is "(conditional get)". The conditional get method can judge a specified resource if it has been updated after a specified date in the If-modified-since header field, and the transfer is not initiated, otherwise it is not transmitted. This conditional get allows cached entities to be refreshed without having to go through multiple requests or unnecessary data transfers, thereby helping to reduce network load. last-modified:Sun, Geneva 23:52:56 GMT ETag: "1cbf3-dfd-3a2adcd8″general application on file download, used to identify the response content of the last modification time or content compared to the code, the next time the user agent needs, the service first determine whether these two values are consistent with the server, the same does not need to return content. Expires: When the response of the request expires, the agent can return the previous response result directly from the cache before it expires. Host:Specifies the host and port number of the requested resource. The http/1.1 request must specify host or the server will return a 400 status code.

HTTP response: Examples are as follows:http/1.1 OK
Date:mon, 04:47:13 GMT
Server:apache
Cache-control:max-age=0
Expires:mon, 04:47:13 GMT
Vary:accept-encoding,user-agent
Connection:close
Transfer-encoding:chunked
Content-type:text/html;charset=utf-8
x-pad:avoid browser bug The status line includes: HTTP protocol version number, status code, status code text description information. such as: http/1.1 OK status code consists of a three-digit number, the status code is roughly 5 kinds of meaning: 1. 1xx. Information, request to receive, continue processing.2.2xx. Success. 200 the request was successful, and the 206 breakpoint continued to pass. 3.3xx. redirect. Generally jumps to the new address. 4.4xx. Client error. 404 file does not exist 5.5xx. Server error. 500 internal error.
Set-cookie:The server sets the client cookie. The format is Name=value, and when you set multiple parameters, the middle is separated by semicolons. Set-cookie will also use a few parameters: path to set a valid path, domain set the name of the cookie in effect, expire set the effective time of the cookie, 0 means that the browser is disabled. Location:This parameter implements redirection when the server returns a 3xx redirect. The jump on the ad link uses this protocol. Content-length: Length of the subsidiary (data entity)

An explanation of each parameter of the HTTP protocol

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.