HTTP protocol learning and http protocol Learning
1. HTTP Overview
HTTP is actually a set of language communication rules! Http uses a reliable data transmission protocol. Therefore, even if the data comes from the other end of the earth, it can ensure that the data is not damaged or messy during transmission.
B/SStructure
In the browser, the user requests the specific file address of the server, which is called the request protocol. Then the server responds to the corresponding information returned by the user request and becomes the response protocol.
Request protocol:
Composition
1. Request the first line
1.1 Request Method 1.2 request address 1.3 request protocol
2. Request Header
HOST
Whether the connection is retained
Content-length Request body length
Cache-control cache Mechanism
The accept return format description tells the server that the returned data packet format is attached: */* indicates all types
User-agent local environment information system version
Content-type body type attachment: Form display application/x-Www-Form-Urlencoded
Referer Source Address
Data returned by accept-encoding supports encoding and compression.
Languages supported by the data returned by accpet-language
Response Protocol:
Composition
1. Response to the first line
1.1 response protocol 1.2 response status code attachment: 200 indicates normal access/successful 404 indicates that the resource is not found 500 indicates internal server error 302 indicates redirection jump
2. Response Header
Server
Type returned by content-type
Length returned by content-length
The date format server generally returns the Greenwell time, which is located in the GMT + 8 hours. Therefore, the returned Time + 8 hours is the current time.
Appendix: The meta of an HTML webpage is mainly used to submit the request information for the server protocol.