Reading "Graphical http"-(HTTP header)

Source: Internet
Author: User
Tags http authentication

Write in front

This chapter is the first information of the request message and the response message is parsed. Through this section of the study, I believe you have a basic understanding of the first structure, and the role of each header field

    • Body

HTTP messages are made up of HTTP headers, empty lines, and HTTP message bodies.

HTTP message bodies primarily load information about users and resources.

The HTTP header provides the required processing information for the client and the server.

1. HTTP message Header

The HTTP header includes the header of the HTTP Request packet and the HTTP response message header.

HTTP request headers are mainly composed of methods (such as: POST, GET), URI, HTTP version, HTTP header field, etc.

HTTP response message header is mainly composed of HTTP version, status code (encoding and Reason phrase), HTTP header field, etc.

(Request message header composition diagram)

(Response message header composition diagram)

2. HTTP header Field

2.1, the first field for the browser and server provides the message body size, language and authentication information, etc.

2.2. The HTTP header field consists of the header field name and the field value (Shape: key:value)

such as: content-type:text/html; indicates that the message body type is text/html type

Keep-alive:timeout=15, max=100; field values are represented by a value

2.3, 4 types of HTTP header fields (divided by Purpose)

A, the General header field (both request and response messages include this type)

B, Request header field (supplementary content of the request, client information, response content priority information, etc.)

C, Response header field (additional content added to the response)

D, the Entity header field (the header used by the message entity; Additional entity information related to resource content, update time, etc.)

3. http/1.1 General Header Field

3.1, Cache-control (Operation caching mechanism)

The header field name supports multiple field values (for example: Cache-control:private,max-age=0,no-cache)

List of Cache-control field values used in the http/1.1 version:

(Request header field value list)

(Response header field value list)

3.2, Connection

3.2.1, control the header field that is no longer forwarded to the agent

(Here, by setting Connection:upgrade, the Upgrade in the header field will no longer be forwarded to the proxy server)

3.2.2, managing persistent connections

http/1.1 is persistent, which means that if the two sides of the communication do not explicitly want to disconnect, then the connection will be used for multiple requests and response communication

(eg: connection:keep-alive)

3.3. Date

Date Header field indicates the day and time the HTTP message was created

3.4. Via

The Via header field is used to track the transmission path of the message over the communication link, and the message passes through the gateway and proxy, and the gateway and proxy add the server's information to the VIA header field value and forward it so that the message is routed through the link

4. Request Message Header Field

4.1, Accept "Notification server, the client needs to obtain the media (such as: text, video audio, etc.) type and media type priority"

The extension types of Accept are: Accept-charset, accept-encoding, Accept-language

4.2, Authorization (when the server needs authentication message, by adding Authorization header field to tell the server, user agent authentication information)

4.3. From (the e-mail address of the user who told the server to use the user agent)

4.4, Host "When deploying multiple domain name virtual machines on one server, this field tells the server which virtual host is requested (for example: Host:www.cnblogs.com)"

4.5, if-*

The first field in the if-* format is a conditional request, which means that the server does not process the request until the server matches the field value of the header field.

4.6, Max-forwards (limit the message on the communication link through the length of the proxy server)

5. Response Message Header field

5.1, Accept-ranges (Tell the client, whether the server can process the scope of the request.) The value can be: None (indicates not supported), bytes)

5.2. Age (tells the client how long the server has processed the request.) The unit is in seconds)

5.3, Etag (Inform the client, the message entity on the service side of the identity)

5.3. Location (informs the client that the requested resource has been redirected to a different URI address)

5.4, Proxy-authenticate (Tell the client, Proxy service required authentication information)

5.5, Retry-after (tell the client how long before the server can be requested again)

5.6, Server (tells the client, server installation of HTTP servers information)

5.7, Www-authenticate (Tell the client, the server uses the HTTP authentication scheme)

6. Entity Message header Field

6.1. Allow (tells the client, the type of HTTP request method supported by the server)

6.2. Content-encodeing (the encoding format used by the server to tell the client that the content of the subject of the requested entity)

6.3, Content-language (Tell the client, the entity body uses natural language [such as: Chinese: ZH-CN])

6.4, Content-length (Tell the client, the size of the entity body is "bytes")

6.5, Content-location (Tell the client, the corresponding URI address of the entity principal)

6.6, Content-type (tells the client, the entity principal object uses the media type)

7. The first field for the cookie service

Because cookies are not programmed into http/1.1 RFC2616, cookies are important for managing the state of a user

(Set-cookie supported attributes and attribute values)

9. Supplementary instructions

9.1. http/1.1 header Field list (for reference)

(Request header Field)

(Response header field)

(Entity header Field)

    • Exchange Learning

I have limited ability. If there is a mistake, look treatise

2017-10-17

In Changsha

Reading "Graphical http"-(HTTP header)

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.