Question: what's http.
A: http is a standard tcp for client and server requests and responses. Actually built on tcp.
When we open a page, it's like this:
More than one s, actually s is tls, ssl. Don't explain here, so the technical base of http is as follows:
The http protocol? http protocol ( hypertext transfer protocol ), that's, hypertext transfer protocol is a transport protocol for server transport to client browser. On web, servers and clients communicate sessions using http protocols. The conclusion of oop is: The structure of its session is a simple request/response sequence that the browser requests and servers respond.
△http 1.0 request mode
At http 1.0, the browser will create a connection individually every visit, which causes waste of resources.
Later http 1.1 can handle multiple requests in a single connection, and overlap multiple requests.
The main features of the http protocol can be summarized as follows:
1. Support for client/server mode.
2. Quick quick: when clients request service to the server, only the request method and path are required. Request methods are commonly used with get, head, post. Each method specifies a different type of connection to the server. Because the http protocol is simple, the http server is small, so the communication speed is very fast.
3. Flexible: http allows tra & port of any type of data object. The type being transmitted is marked by content type.
No connection: no connection means to restrict each connection to only one request per connection. The server processes the customer 's request and receives the client 's answer after it's received. In this way, the transmission time can be saved.
5. Stateless: http protocol is stateless protocol. No state refers to the agreement for transactions without memory. Missing state means that if subsequent processing requires the previous information, it must be retransmission so that the amount of data transmitted per connection increases. On the other hand, the answer is faster when the server doesn't require a previous message.
Http protocol has been used for data transmission between web server and browser because it's simple and fast. However, there are obvious problems in the process of data transmission, because http is the plaintext protocol, no way to encrypt the data. When hackers steal the transport packets between web servers and browsers, they can read the transmitted information directly, resulting in a web site, a. So http doesn't apply to the propagation of sensitive information, which needs to introduce https ( hypertext transport security protocol ).
Https transfer protocol secure is a transport protocol based on computer security communication. The ssl layer is added under http, which has the ability to protect exchange data privacy and integrity and provide authentication for the site server.
Http messages consist of requests from client to server and response from server to client.
For one, the request form is as follows:
请求行 通用信息头 请求头 实体头 （空行） 报文主体
As shown in figure, the contents of the message sent when I ask for an article:
For the request message:
1、请求行 方法字段 + URL + Http协议版本2、通用信息头Cache-Control头域：指定请求和响应遵循的缓存机制。 keep-alive 是其连接持续有效【在下面百度的例子，会得到验证】3、请求头 Host头域，脑补吧Referer头域：允许客户端指定请求URL的资源地址。 User-Agent头域：请求用户信息。【可以看出一些客户端浏览器的内核信息】4、报文主体 如图中的" p=278"一般来说，请求主体少不了请求参数。
Second, the answer report form is as follows:
状态行 通用信息头 响应头 实体头 （空行） 报文主体
In figure, it's the content of this blog response:
对其中响应报文详解：1、状态行 HTTP协议版本 + 状态码 + 状态代码的文本描述 【比如这里，200 代表请求成功】2、通用信息头 keep-alive 是其连接持续有效【在下面百度的例子，会得到验证】Date头域：时间描述3、响应头Server头：处理请求的原始服务器的软件信息。4、实体头 Content-Type头：便是接收方实体的介质类型。（这也表示了你的报文主体是什么。） （空行）5、报文主体 这里就是HTML响应页面了，在截图tab页中的response中可查看。
A simple request/response is complete.