Zero basic learning interface test-basic knowledge of HTTP protocol

1. URL: Uniform Resource Locator

2. The form of URL:

<protocol>://[<user>:<password>]@<host>:<port>/<path>[:<params>]?<query>#<fragment>

protocol: access protocol, such as: http, https, ftp

host: host name, sometimes ip, sometimes domain name, for example: 192.168.10.12, www.baidu.com.

port: Port, the port of the host when accessing. The http protocol port defaults to 80, which can be omitted.

path: We can find the host through host: port, but there are many files on the host, and you can locate specific files through path. For example: https://baike.baidu.com/item/software testing / 327953

params: pass parameters to the server, generally rare

query: query string, you need to query the content from the server, enter it here. For example: www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd=%E8%BD%AF%E4%BB%B6%E6%B5%8B%E8%AF%95

Fragment: Fragment, the web page may be divided into different fragments, if you want to reach the specified position directly after visiting the web page, you can set it in this part

Examples:

( 1) Sina star:

http://slide.ent.sina.com.cn/star/slide_4_704_336821.html#p=1

( 2) Baidu search:

https://www.baidu.com/s?rtt=1&bsst=1&cl=2&tn=news&rsv_dl=ns_pc&word=%E8%BD%AF%E4%BB%B6%E6%B5%8B%E8%AF%95

3. http protocol:

HTTP (Hyper Text Transfer Protocol, Hypertext Transfer Protocol): is a stateless, application-layer protocol based on request and response mode, connected by TCP, default port: 80.

4. HTTP workflow:

( 1) The client and the server establish a TCP connection.

( 2) The client sends a request to the server.

( 3) The server receives the client's request and returns the response content according to the request.

( 4) The client receives the response content from the server, and the parsed content is displayed on the front end; then the client disconnects from the server.

5. Features of HTTP:

( 1) Support client / server mode.

( 2) Simple and fast: When a client requests a service from a server, only the request method and path need to be transmitted.

( 3) Flexible: HTTP allows transmission of any type of data object.

( 4) Do not save the state: if the previous information is needed for subsequent processing, it must be retransmitted.

      a. Disadvantages: may lead to an increase in the amount of data transferred per connection.

      b. Advantages: The server does not need previous information to respond faster, reducing server CPU and memory consumption.

      c. Introduction of cookies and session mechanism: Cookie records information on the client to determine the user's identity, and Session records information on the server to determine the user's identity.

( 5). Connectionless: only one request is processed per connection. After the server processes the request and receives the response, it disconnects.

      a. Disadvantages: TCP connection must be established / disconnected for each request , and the communication overhead increases.

      b. Advantages: using this method can save transmission time.

      c. Subsequent introduction of persistent connection (HTTP keep-alive): In a TCP connection, multiple data can be continuously sent without disconnecting, reducing the number of tcp connection establishment; the general server will set the keep-alive timeout and the maximum number of connections .

keep-alive timeout: close the connection more than this time after transmission

Maximum number of connections: After reaching the maximum number of connections, a new request initiates a connection, and the previous connection will be closed if the timeout is not reached

6. Disadvantages of HTTP:

( 1) Stolen: Http communication uses plain text, without any encryption measures during transmission, it may be eavesdropped.

( 2) Encounter camouflage: During the transmission process, without verifying the identity of the communicating party, it is possible to encounter camouflage in the middle

( 3) Tampered: Http only parses the message and does not verify it completely, so the integrity of the message cannot be verified, and it may be tampered with.

Guess you like

Origin blog.51cto.com/14790982/2487224