HTTP protocol details

•1HTTP knowledge 1.1 introduction to HTTP the q&a interaction between the WEB browser and the WEB server must comply with certain rules, namely the HTTP protocol.

**• 1KNOWLEDGE of HTTP

**1.1 Introduction to HTTP – Introduction to HTTP **

** the q&A interaction between the WEB browser and the WEB server must follow certain rules, and this rule is HTTP protocol. •HTTP is short for hypertexttransfer protocol, an application-layer protocol in the TCP/IP protocol set that defines the process of exchanging data between WEB browsers and WEB servers, as well as the format of the data itself. •HTTP version HTTP/1.0, HTTP/1.1, http-ng ** **1.2 HTTP related knowledge **(2) — **HTTP ** session mode

**• Four steps:

All communication between the browser and the WEB server is completely separate request and response pairs. ** 1.3 HTTP (3) — HTTP1.0 vs. HTTP1.1** • 2 HTTP requests 2.1HTTP request(1) – * * * *An overview of theItem 1. Request line item 2. Several headers item 3. Entity content (possibly none), as follows: 2.2 HTTP request (2) –The request line * * 2.3 HTTP *Request * *(3) ——**Request message header * *(**Request header **) * *2.4 HTTP * *Request * *(4) — **Request body *• POST request: If the form is submitted as POST, the form item’s data is sent to the server as the request body, with no size limit• 3 HTTP response *3.1 HTTP * *In response to the * *(1) – **An overview of the *One status line Several headers (response headers) Entity content (response body)* * 3.2 HTTP *In response to the * *(2) *In response to the *The status line *• Status line • The status code is a three-digit decimal number that represents the result of the server’s processing of the request. The response status code is divided into 5 categories, as follows: 3.3 HTTP The response(3) – * * * *Response header (Response headers) 3.4 HTTP The response(4) – * * * *Response body

The connection between the browser and the WEB server is transient, with only one request and response per connection. For each page accessed, a separate connection is made between the browser and the WEB server.

The GET in the request line is called the request mode, and the request mode is:

POST, GET, HEAD, OPTIONS, DELETE, TRACE, PUT

The common ones are GET and POST

If the user does not set this parameter, the browser sends get requests to the server by default. For example, the browser directly enters the address for access and clicks the hyperlink for access. If the user wants to change the request mode to POST, the user can change the form submission mode to achieve this.

Both POST and GET are used to request a WEB resource to the server. The difference between the two methods is mainly in data transfer:

If the request mode is GET, the URL can be followed by? Takes the data to the server in the form of &. For example:

GET/mail/1.html? Name = abc&password = xyzHTTP / 1.1

The GET mode has the following characteristics: The parameters attached to the URL address are limited. The data capacity of the GET mode usually cannot exceed 1K.

If the request mode is POST, data can be sent to the server in the entity content of the request. The value of the POST mode is unlimited.

Accept:text/ HTML,image/* Accept-charset: utF-8 Accept-encoding: UtF-8 accept-encoding: utF-8 accept-encoding: Support gzip compression Accept – Language: en – us, useful – cn supported languages Host: localhost: 8888 requests the hostname of the Referer: www.atguigu.com/index.jsp hair… Url Anti-theft link User-agent: Mozilla/4.0 related information Connection: keep-alive Whether to disconnect or connect after the request is completed Date: Tue, 11 Jul 2000 18:23:51 GMT Time to send a request Cookie: TT =123 //

An HTTP response represents data sent back from the server to the client, including: ** **

Format: HTTP version number Status code Description example: HTTP/ 1.1200OK response header (data sent by the browser to the server to tell the server something): Location: / day05 / index. The JSP tell the browser to redirect to the specified path Server: apache tomcat using any web Server Content – Encoding: Gzip tells the browser how to compress the data I send to you. Content-length: 80 Specifies the number of bytes in the response body. Content-language: zh-CN Specifies the Language of the response body data. Charset =GB2312 Type of response body HTML/CSS/image Last-Modified:Tue, 11 Jul 2000 18:23:51 GMT Refresh: Content-disposition: Attachment; content-disposition: Attachment; Filename =aaa.zip prompts the user to download set-cookie :SS=Q0=5Lb_nQ; Path =/search Returns cookie data to IE Expires:-1 tells the browser not to Cache it cache-control: No-cache Pragma:no-cache Connection:close/ keep-alive Whether to Keep a Connection Date: Tue, 11 Jul 2000 18:23:51 GMT Time of the response The actual data displayed by the browser is usually an HTML text or other type of data

Focus on Java field development, from using the skills to the underlying source code, to the big data from a database, from multiple threads to high concurrency,, you want to have a person could go faster, but a group of people will go further, make haste to subscribe to pay attention to small farmers, let’s go together, pay attention to small farmers, knowledge to pack out, everyone refueling