Recently, I have learned HTTP and HTTPS Relevant knowledge , Because there is more content , Here's a summary of my mistakes
stay MDN Explain it like this
Hypertext transfer protocol （HTTP） It's a program for transferring hypermedia documents （ for example HTML） Application layer protocol . It is for Web Browser and Web Designed for communication between servers , But it can also be used for other purposes .HTTP Follow the classic client - Server model , The client opens a connection to make a request , Then wait until you receive a response from the server .HTTP Stateless protocol , This means that the server does not keep any data between the two requests （ state ）
Hypertext transfer protocol
be based on TCP/IP Application layer protocol of communication protocol
HTTP The default port number is 80
It's a stateless protocol
Be careful ： Stateless means having no memory for transactions , Such as adding, deleting, modifying and checking , Every time a browser makes a request , All return the same response content , Each response content is independent , The previous request could not get the content information of the previous request , This is not allowed in data interaction scenarios .
Take a chestnut ：
Login status of the website 、 Add items to cart 、 Modify user information and other transaction scenarios , All of these need to be recorded after one operation , To ensure that when the browser refreshes or clicks on other pages , The previous request status will be recorded , Ensure the interaction between the two pages .
|GET||Request the specified page information , And return the entity body .|
|POST||Submit data to the specified resource for processing request （ For example, submit a form or upload a file ）. Data is contained in the request body .POST Requests may result in the creation of new resources or the modification of existing resources .|
HTTP1.1 comparison HTTP1.0 Save bandwidth
Different cache processing
stay HTTP1.0 Medium main use header Inside If-Modified-Since,Expires As the criterion of cache judgment .
stay HTTP1.1 More cache control strategies are introduced, such as Entity tag,If-Unmodified-Since, If-Match, If-None-Match Wait for more alternative cache headers to control the cache policy .
Different connection modes and pipeline processing of requests
HTTP1.0 Supports transient connections , Every time a browser sends a request, it needs to set up TCP Connect , Wait for the server to complete the request before disconnecting , And the server doesn't track and record past requests .
HTTP1.1 Supports long connections , New request headers need to be added to help implement , And in the same TCP You can transfer multiple HTTP Requests and responses .
Host Head treatment is different
stay HTTP1.0 Each server is bound to a unique IP Address , therefore , In the request message URL Host name not passed hostname.
stay HTTP1.1 Both request and response messages support Host Header fields , And if there is no Host The header field will report an error :400 Bad Request.
New error notification management
stay HTTP1.1 Added in 24 Error status response code .
HTTP1.1 The parsing of text protocol is all kinds of parsing based on text protocol , and HTTP2.0 Protocol parsing for is in binary format , More powerful .
HTTP2.0 Support multiplexing : A connection can handle multiple requests concurrently .
There can be more than one connection request, And can be mixed up randomly , Each is different request There are corresponding id, The server can use request_id To identify , Greatly speed up the transmission rate .
HTTP2.0 Supports header data compression : HTTP2.0 Yes header The data is compressed , Speed up network transmission .
HTTP1.1 Medium header You need to carry a lot of information , And send it repeatedly every time .http2.0 Use encode To reduce the transmission of header size . And the client and the server can cache one copy each header filed surface , Avoided header Repeat transmission of , It can also reduce the size of the transmission .
HTTP2.0 Support server push : Through analysis html When resources in , When parsing to the import file , Return the required file (css perhaps js etc. ), Instead of making another request .
HTTPS（ Safe HTTP） yes HTTP Encrypted version of the protocol . It usually uses SSL (en-US) perhaps TLS To encrypt all communication between client and server . This secure link allows clients to safely exchange sensitive data with the server , For example, online banking or online mall operations involving money .
|1**||Information , The server receives the request , Requester is required to continue|
|2**||success , Operation received and processed successfully|
|3**||Redirect , Further action is required to complete the request|
|4**||Client error , The request contains a syntax error or could not be completed|
|5**||Server error , The server encountered an error while processing the request|
|100||continue||Initial request accepted , Please continue sending the rest|
|101||Handover protocol||Request this requires the server to switch protocol , The server has determined to switch|
|200||success||The server has successfully processed the request|
|201||Created||The request succeeded and the server created a new resource|
|202||Accepted||Request accepted by server , But not yet processed|
|203||Unauthorized information||The server successfully processed the request , But the information returned may come from another source|
|204||There is no content||The server successfully processed the request , But nothing is returned|
|205||Reset Content||Server processed successfully , The user terminal should reset the document view|
|206||Part content||Server successfully processed part GET request|
|300||Multiple choice||Request for , The server can perform many operations|
|301||A permanent move||The requested page has permanently jumped to the new url|
|302||Temporary movement||The server is currently responding to requests from pages in different locations , But requests continue to use the original location for future requests|
|303||View other locations||The requester should use separate GET When requesting to retrieve a response , The server returns this code|
|304||not changed||Since last request , The requested page has not been modified|
|305||Using agents||The requester can only use a proxy to access the requested web page|
|307||Temporary redirection||The server is currently responding to requests from pages in different locations , But the requester should continue to use the original location for future requests|
|400||Wrong request||The server does not understand the syntax of the request|
|401||unauthorized||The request requires the user's authentication|
|403||prohibit||Server rejects request|
|404||Not found||The server could not find the requested page|
|405||Method disable||Disable the method specified in the request|
|406||Don't accept||Unable to respond to the requested page with the requested content attribute|
|407||Proxy authorization required||The request requires proxy authentication|
|408||request timeout||Server timed out waiting for request|
|409||Conflict||Server conflicts when completing request|
|410||deleted||The resource requested by the client no longer exists|
|411||Effective length required||The server does not accept requests without valid length header fields|
|412||Preconditions not met||The server does not meet one of the prerequisites set by the requester in the request|
|413||Request entity too large||Because the request entity is too large , Server cannot process , So reject the request|
|414||request url Too long||Requested url Too long , Server cannot process|
|415||Format... Is not supported||The server was unable to process the media format attached to the request|
|416||Invalid scope||Invalid range requested by client|
|417||Not meeting expectations||The server cannot meet the request header field requirements|
|500||Server error||Server internal error , Unable to complete request|
|501||Not yet implemented||The server does not have the function to complete the request|
|502||Bad Gateway||There was an error with the server acting as a gateway or proxy|
|503||Service not available||The server is currently unavailable|
|504||gateway timeout||Gateway or proxy server , Not getting requests in time|
|505||Version is not supported||The server does not support HTTP Protocol version|