This is the 30th day of my participation in the August Text Challenge.More challenges in August

1. Features of HTTP

  • Quick and simple: URIs are fixed
  • Flexible:
  • No connection: The connection will be disconnected once
  • Stateless: client and server

2. Request packets

Request line (HTTP method, page address, request method), request header (parameter key: value), blank line, request body

3. Respond to the packet

Status line, response header, blank line, response body

4. HTTP method

  • GET — Gets the resource
  • POST — Transfers resources
  • PUT — Updates resources
  • DELETE — Deletes the resource
  • HEAD: gets the header of the packet

5. Differences between HTTP GET and POST

  • GET does no harm when the browser falls back, and POST requests again
  • The URL generated by GET can be bookmarked, but POST cannot
  • GET requests are actively cached by browsers, whereas POST is not, unless set manually
  • GET request parameters remain intact in browser history, while POST parameters do not
  • GET requests transfer parameters in the URL with length limits, whereas POST does not
  • The GET argument is exposed in the URL, which is not as secure as POST
  • The GET argument is passed through the URL, and the POST is placed in the request body

6. The HTTP status code

  • 1xx: indicates that the request has been received and processing continues
  • 2xx: Succeeded: The request is accepted successfully
  • 3xx: redirect, further action must be taken to complete the request
  • 4xx: client error. The request has syntax error or cannot be implemented
  • 5xx: The server failed to fulfill a valid request

\

  • 200 OK: The client request is successful
  • 302: Redirect, the requested page is temporarily moved to a new URL
  • 304: The client has a cached document and issues a conditional request. The server tells the user that the previously cached document can still be used
  • 403: The requested resource is denied access
  • 404: Requested resource does not exist
  • 500: Server error
  • 503: The server is temporarily overloaded or down

7. Persistent connections

Only HTTP1.1 support

HTTP uses the request-reply mode. For each request, the client and server create a new connection and disconnect the connection

If keep-alive is used, the connection between the client and the server is kept Alive. In case of subsequent requests to the server, the connection is not re-established

8. Pipelines

Only HTTP1.1 supports, only GET and HEAD requests can be piped, POST is limited

In the case of persistent connections, requests are responded to once

Request 1-> Response 1-> Request 2-> Response 2-> Request 3-> Response 3

Package the request and send it

Request 1-> Request 2-> Request 3-> Response 1-> Response 2-> Response 3