2. Schematic http-http protocol

Source: Internet
Author: User
Tags representational state transfer ftp protocol

1.HTTP Introduction

HTTP is used for communication between the client and the server

In fact, the client and server roles are likely to be interchangeable, but from a communication line, the servers and client roles are deterministic, and the HTTP protocol knows that it is the client side of the service.

The HTTP protocol specifies that the request is made from the client and the server responds to the request and returns. The response is not sent when the server does not accept the request.

Client sends the contents of the request message to the server side

GET: The request type, called method;

/index.htm: Requested resource object, also known as URI (Request-uri);

Version number of the Http/1.1:http

Server-side corresponding content is as follows

2.HTTP is a stateless protocol

HTTP protocol does not save request and response information

Whenever a new request is sent, a corresponding new response is generated, and the protocol itself does not retain the information of all previous requests or response messages, in order to deal with a large number of transactions faster, to ensure the scalability of the Protocol, and specifically to the HTTP protocol into such a simple.

Although the HTTP protocol is a stateless protocol, in order to achieve the desired hold-state function, the introduction of cookie technology, with a cookie can be managed state.

Method of 3.HTTP protocol

Get: Get Resources

The Get method is used to request access to a resource that has been identified by the URI, and the specified resource returns the corresponding content after the server-side resolution.

POST: Transport entity Body

The Post method is used to transfer the body of the entity, although the Get method can also transfer the body of the entity, but the general situation is not transmitted using the Get method, but by using the Post method. The function of post is similar to get, but the main purpose of post is not to get the main content of the response.

PUT: Transferring files

The Put method is used to transfer files, just like FTP protocol file uploads, requiring the body of the request message to contain the contents of the file and then save it to the requested URI at the specified location. However, because the http/1.1 put method itself does not have a validation mechanism, anyone can upload files, there is a security issue, so the general Web site does not use this method. Using the Put method is possible if you are working with a Web application's validation mechanism, or if the architecture is designed to use a similar web site with rest (representational state Transfer, representational status transfer) standards.

HEAD: Get message header

The head method, like the Get method, does not return the subject part of the text to confirm the validity of the URI and the date and time of the resource update.

Delete: Deleting files

The Delete method, in contrast to the Put method, is used to request the deletion of the specified file, as in the Put method.

Options: Ask a supported method

The options method is used to query for the supported methods of the resource for the request URI.

Trace: Trace Path

The trace method is a method that allows the Web server to loop back the previous request communication to the client. When sending a request, fill in the number in the Max-forwards header field, minus 1 on a server side, stop the transmission when the value is just down to 0 o'clock, and finally the server side receiving the request is put back to the response of the status code 200OK.

The trace method allows the client to query how the requested request is processed, modified/tampered with, but it is prone to xst attacks, which are not normally used.

Connect: Require tunneling protocol to connect proxies

It is required that the proxy server communication is to establish a tunnel, the implementation of the tunnel protocol for TCP communication, mainly using SSL (Secure Sockets) and TLS (Transport Layer Security) protocol to encrypt the communication content after the network tunnel transmission

Connect method Format:

3. Durable connectivity saves traffic

The previous communication situation is the transmission of small text, so the problem is not large, with the popularity of HTTP, the document contains a lot of pictures of the situation, such as a browser to browse a page containing multiple images, will also request the HTML page contains other resources, Each request causes a meaningless TCP connection to be established and disconnected, increasing the overhead of the traffic.

In order to solve the problem of TCP connection above, http/1.1 proposed a method of persistent connection. The feature of persistent connections is that the TCP connection state is maintained as long as the disconnect is not explicitly made at either end.

Pipeline

Persistent connections are the most requests that can be routed in a pipelined manner. Before sending a request, you wait and respond before sending the next request, and the pipeline technology does not wait for a response to send the next request directly. This allows multiple requests to be sent in parallel at the same time without requiring a wait response one after the other.

4.Cookie State Management

Cookie technology controls client state by writing cookie information in request and response messages

The cookie notifies the client to save the cookie by responding to the Set-cookie header field information in the message, and the client automatically adds the cookie value to the request message the next time the client sends a request to the server. After the server-side discovery client sends a cookie, it checks the connection request from which client, then compares the server's record and finally gets the status information.

2. Schematic http-http protocol

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.