I share, one of the four big request header fields, before I was in an article – “common Http header fields” wrote the common first field, contains four kinds of common request header fields, but I have not detailed explain these fields, we are all pay attention to the people, since wrote let’s write a vivid, Today we will look at the request header field which has the most fields (19) among the four header fields.
The request header field, as the name implies, is used by the requester. It can only carry information about the client, some requests from the client, the priority of the response requested by the client, and so on. Let’s look at the 19 fields
1、 Accpet
It tells the server what type of media the client can Accept. We can divide it into text type, image type, video type, and binary type
Text type Text/HTML, text/ CSS……
Image type: image/ PNG image/ JPG image/ GIF…..
Video type: video/mpeg video/quitime…….
Application binaries: Application /zip applilcation/octet-stream……..
The main purpose is to tell the server which media types the client can accept. Multiple media types are separated by commas and semicolons if weighted. Q =1, q refers to 0-1 at most three decimal digits, default is 1
2, the Accept – Charset
Accept-charset refers to the set of characters that the client can Accept, and also to the set of characters that the client can preferentially process.
3, the Accept – Language
It is the natural language that is acceptable to the client, and it is also the preferred language. Q can be used together.
4, Accept – Encoding
The encoding format that is acceptable to the client can also be understood as the encoding format that is preferentially processed, and q can be used together.
Commonly used gzip Comperss
5, If – Match
If the values are consistent, the response side returns 200 and the resource. If they are inconsistent, the response side returns 412. The client requests the resource again
6, the If – None – Match
This is the opposite of if-match left and right
7, If – Modified – since
This field is also interesting. When requesting a resource with this field in the header, the server will compare the header value: ‘date value’ to the last-modified value of the resource entity.
If so, return 304
Otherwise return 200 and the body of the response
8, If – Unmodified – Match
As opposed to if-modified-since but If so, 412 is returned and the client requests again
9, If – Ranges
This field is also interesting because it is used in conjunction with the header field of the Range request. The value of this field is also a string that uniquely represents the resource. The server compares the value of ETag to the value of ETag.
If this is consistent return 206 and the requested return value
If not, return 200 and all response resources
10 and the Range
This field is used for range requests. If the server supports range requests, you can add this field to the header of the request. The value “batys: 1000-10000” indicates that the range of the request is 100-10000.
The server finds that the scope request did not exceed the resource scope and returns 206 OK
If the scope of the request exceeds the scope of the resource it will return 200OK,
It also returns 200OK if the server does not support it
11, the Host
This field is usually used to distinguish VMS with the same IP address from VMS with the same IP address
12, the From
From: ‘Email address’ and tell the server to contact this email address if there is any problem
13 and Authorization
The field used in the request when the server requests client authentication (usually DIGUST and BASIC authentication, see DIGEST Authentication and BASIC Authentication).
14, the Proxy Authorization
Fields that are included in the request when the proxy web authentication is requested by the server
15, the user-agent
Some information on the client, sometimes with the user’s email
16, Referer
The user represents the URI of the original requesting party
17, Expcet
Asking the server if it can do something,
If the server can do it, return 100 contiune
Otherwise 417 Expectation Failed
18, TE
Remember the accept-Encoding header field? TE and Accept-Encoding functions are similar to each other in that they are used for the transfer Encoding format that can be handled, but there is also a feature that lets you know about the Trailer chunking format
19, the Max – Forwrads
This field is also very interesting, he used the biggest jump one by one, he is the value of the Arabic Numbers, it is mainly used for testing the middle server that we have a problem, such as there is now a request takes 10 middle server to request to the real server, but suddenly in the middle of a server down, front end is actually don’t know that server is down, You will need to ask the header to join max-Forwrads to test the server problem.