One: Network protocol HHTP
Hypertext Transfer Protocol
RFC2616
II: Main structure of HTTP message
1) Request
Method (Get,post)---request method
URL-------Request Address
Header------Request Header
Body--------Request Body
2) Response
Status code-------state codes
Header--------Response Header
Body--------Response Body
Three: HTTP status code
200: Success, this success only means that the server normal processing is complete, and does not represent the correctness of the logic
301,320: Jump, generally can see in the header location, that is, jump address, the difference is a temporary jump is a fixed jump
304: Unmodified, the server discovers that the resource file identity is not changed, and notifies the client to read the local cache file.
400: Client Request Information Format problem
403: Generally prohibit access, such as files, directories, etc. exist, but do have access restrictions
404: Generally a file, directory does not exist, but can also disguise other situations as non-existent
500: The appearance of this is generally the service side of the code directly throws an exception causes
502,503,504: This is similar, in the case of network anomalies and so on can appear, there are a lot of code thrown when the error occurs
Four: HTTP general header information and function (Request)
Host: must exist, domain name specified (similar and categorized, but Port used to differentiate access to that domain name)
Accept: Represents an acceptable type of information, similar to the recommendation, has children
User-agent: Client Identity information (System version, browser, kernel, etc.)
Cookies: Special information storage locations for automatic interaction without code interference
Referer: The source, that is, the request triggered by what page or file, if it is the browser address bar carriage return does not have this value
Connection: Control length link, tell the other side the current link status (Keep-alive,close)
Range: Specifies the range of information returned (breakpoint persistence subclass use)
Content-type: Type of request body, encoding and other information
Content-length: Request Body length
If-modifiled-since: Cache-dependent, local file identification validity period
If-none-match: Cache-dependent, local file signature, corresponding to the ETag in the return message
V: HTTP General header information and function (Reaponse)
Date: Time, typically the current time of the server
Content-encoding: Returns the compression encoding type of the body
Content-length: Returns the length of the body
Content-type: Returns the type of body, encoding and other information
Cache-control: Caching mechanisms and policies, time, methods, etc.
Etag: Returns the signature of the file information
Expires: The cache of returned file information has a deadline
Set-cookie: A Cookie that requires settings, header information that can occur multiple times
Location: Auto Redirect to other new addresses, general status 301,302 appears
Connection: Control long link, tell the other side of the current link state, the default keep, when both sides are keep when the link will be in the next
Analysis of HTTP protocol data structure