http protocol

Posted May 25, 20202 min read

1. http request method

The HTTP request method was proposed in versions 1.0 and 1.1. There are get, head and post in version 1.0, and put, delete, patch, options, trace and connect are added in version 1.1
http 1.0:

  • get:Get the information of the specified page, and return the entity
  • head:Get head information, there is no corresponding response entity
  • post:Used to submit a form, add data, the data is included in the request body, used to create a record or modify a record

http 1.1:

  • put:modify an existing record, or replace a record.
  • delete:represents deleting a record.
  • options:Allow clients to view server performance.
  • patch:is a supplement to the put request method, allowing partial updates to existing records.
  • tace:mainly test or diagnose the request.
  • connect:reserved for proxy servers that can change the connection to a pipeline.

2.http response status code

  • 1 \ * \ *:indicates that the request needs to be continued

  • 2 \ * \ *:indicates successful request

  • 3 \ * \ *:Redirect, need further operation, and then complete the request

  • 4 \ * \ *:client error

  • 5 \ * \ *:server error

    101:continue The client should continue the request
    102:switching protocol The server switches the protocol according to the client's request.

    200:ok request succeeded. Generally used for GET and POST requests
    201:created has been created. Successfully requested and created a new resource
    202:accepted has been accepted, but not completed
    203:non-auth-info unauthorized information request succeeded
    204:no content No content. Server successfully processed
    205:reset content
    306:partial content. The server successfully processed part of the get request
    300:multiple choices
    301:moved permanently
    302:found temporarily moved
    303:see other View other addresses
    . . .
    400:bad request The syntax of the client request is wrong, and the server cannot understand it
    401:Unauthorized request requires user authentication
    402:payment required reserved for future use
    403:The server understands the request from the client, but refuses to execute the request
    404:not found The server cannot find the resource according to the client's request.
    405:method not allowed The method requested by the client is forbidden
    406:Not acceptable server cannot complete the request based on the content characteristics requested by the client
    . . .
    500:internal server error Internal server error, service completion request
    501:The not implemented server does not support the requested function and cannot complete the request
    502:Bad gateway received an invalid request from a remote server when the server working as a gateway or proxy tried to execute the request
    503:service unavailable system overload, system maintenance
    504:gateway time-out gateway or proxy server to obtain the result
    505:http version not supported The server does not support the http protocol version