HTTP protocol January 27,2020

## HTTP protocol:
a request message: The client sends to the server-side data
  * data format:
    1. Request line
    2. Request header
    3. Request blank line
    4. The request body
Second, a response message: The server sends the data to the client
  * data format:
    1. response line
      1. composition: protocol / version response status codes status code description
      2. response status code: the server tells the client browser to the current state of a request and response.
        1. The status code is a 3-digit
        2 Category:
          1. 1xx: the server receiving the client message, but did not receive complete, waiting for a period of time, multi-state transmission 1xx code
          2. 2xx: Success. Representatives: 200
          3. 3xx: Redirection. Representative: 302 (redirect), 304 (cache access)
          4. 4xx: Client Error.
              Representative *:
                * 404 (there is no corresponding resource request path)
                * 405: doXxx embodiment no corresponding request method
          5. 5xx: Server side error. Representative: 500 (internal server abnormal)


    2 response header:
      1. Format: first name: value
      2. Common response headers:
        1. Content-Type: The server tells the client response body of data formats and encoding format
        2. Content-disposition: Open the server tells the client what format the response body data
          * value:
            * in-Line: default value, within the current open page
            * attachment; filename = xxx: open response body attachment. Download
    3. Response blank line
    4. Response body: data transmission


        * 响应字符串格式
          HTTP/1.1 200 OK
          Content-Type: text/html;charset=UTF-8
          Content-Length: 101
          Date: Wed, 06 Jun 2018 07:08:42 GMT

          <html>
          <head>
          <title>$Title$</title>
          </head>
          <body>
          hello , response
          </body>
          </html>

 

Guess you like

Origin www.cnblogs.com/yyanghang/p/12235964.html