PS: Refer to some blogs for review ~

HTTP and HTTPS

  • HTTP: the most widely used network protocol, browser efficient.
  • HTTPS: secure version, encryption over SSL, encrypted transmission, identity authentication, and keys.

The difference between:

  1. Compared with HTTP, HTTPS adds SSL layer, encrypted transmission, and identity authentication.
  2. You need to apply for a charging certificate from CA.
  3. Secure but time-consuming, caching is not very good.
  4. The port number varies with the connection mode. HTTP is 80 and HTTPS is 443.

The HTTP request header

  • Accept: indicates the format accepted by the browser.
  • Accept-encoding: Indicates the Encoding format accepted by the browser.
  • Accept-language: indicates the Language accepted by the browser and used by the server to determine multiple languages.
  • Cache-control: controls the Cache timeliness.
  • Connection: indicates the Connection mode. Keep-alive and supported by the server, TCP connections are multiplexed.
  • Host: indicates the domain name used for HTTP access.
  • If-modified-since: A change event Since the last access. If the server thinks it has not updated Since then, a 304 response will be given.
  • If-none-match: The e-tag used for the last access, usually a summary of the information on the page, which is more accurate than the change time.
  • User-agent: Client identifier. This field is complicated in most browsers for some historical reasons, including operating system, browser kernel, version number, etc.
  • Cookie: Cookie string stored by the client.

The HTTP status code

  • 100 Continue When a POST request is sent, the server sends an acknowledgement message after the HTTP header has been sent, and then sends specific parameter information.
  • 200 OK A normal message is displayed.
  • 201 Created The request succeeds and the server creates a new resource
  • 202 Accepted the request has been Accepted but not yet processed.
  • 301 Moved Permanently The page for the Permanently Moved Permanently to the new location.
  • 302 Found Temporary redirect.
  • 303 See Other Temporary redirects and always uses GET to request new URIs.
  • The requested page has Not been Modified since the last request.
  • 400 The Bad Request server cannot understand the format of the Request. The client should not attempt to use the same content to initiate a Request again.
  • 401 Unauthorized The request is not authorized.
  • 403 Forbidden Forbidden access.
  • 404 Not Found No resource matching the URL was Found.
  • 500 Internal Server Error Common Server errors.
  • 503 Service Unavailable The server cannot process requests temporarily (maintenance or overload is possible).

HTTP1.0, HTTP1.1, HTTP2.0 details

  1. A long connection
  • Short connection: Each HTTP operation between the client and server establishes a connection and breaks the connection at the end of the task.
  • Long connection: The TCP connection between the client and the server for the transmission of HTTP data is not closed. When the client accesses the server again, it continues to use an established connection.
  • HTTP1.0 requires the keep-alive parameter to tell the server to establish a long connection, whereas HTTP1.1 supports long connections by default.

HTTP1.0 is stateless and has no connection.

HTTP1.1 persistent connection, request pipelinization, increase cache processing (such as cache-control), increase the Host field, support breakpoint transmission, etc.

HTTP2.0 binary framing, multiplexing, header compression, server push.