Summary of questions about HTTP related polygons

Source: Internet
Author: User

1. What are the common HTTP methods?
GET:
Used to request access to a resource that has been identified by a URI (Uniform Resource Identifier) that can be passed to the server via a URL
POST:Used to transfer information to the server, the main function is similar to the Get method, but it is generally recommended to use post mode.
PUT:Transfer file, the message body contains the contents of the file, save to the corresponding URI location.
HEAD:Gets the message header, similar to the Get method, but does not return the text body, generally used to verify that the URI is valid.
DELETE:Delete the file, as opposed to the Put method, to delete the file that corresponds to the URI location.
OPTIONS:Query the HTTP method supported by the corresponding URI.


2. The difference between the Get method and the Post method
difference one:

Get focus on getting resources from the server, post focus on sending data to the server;
Difference Two:
Get transfer data is sent through a URL request, in the form of field (fields) = value, placed after the URL and used with "?" Connection, with "&" connection between multiple request data, such as http://127.0.0.1/Test/login.action?name=admin&password=admin, this process user is visible;
Post transmission data through the post mechanism of HTTP, the field and corresponding values are sealed in the request entity sent to the server, the process is not visible to the user;
Difference Three:
Get transmits a small amount of data because it is limited by URL length, but is more efficient;
Post can transmit a large amount of data, so you can only use post when uploading files;
Difference Four:
Get is unsafe because URLs are visible and may reveal private information, such as passwords, etc.;
Post is higher security than get;
Difference Five:
The Get method can only support ASCII characters, and Chinese characters passed to the server may be garbled.
The post supports the standard character set, which correctly passes Chinese characters.


3. HTTP request message and Response message format
The request message contains three parts:

A, request line: Contains the request method, URI, HTTP version information
B. request header Field
C. Request Content Entity
The response message contains three parts:
A, status line: Contains the HTTP version, the status code, the status code of the reason phrase
B, Response header field
C, Response content entity


4, the common HTTP corresponding status code
£ º
Request is handled normally
204:Requests are entertained but no resources can be returned
206:The client is simply a part of the request resource, and the server executes the Get method only for the requested part of the resource, and the resource in the corresponding message is specified by Content-range.
301:Permanent redirection
302:Temporary redirection
303:Similar to the 302 status code, except that it expects the client to be redirected to another URI by a get method when requesting a URI
304:Returns when a condition is not satisfied when sending a request with a condition, regardless of redirection
307:Temporary redirection, similar to 302, just forcing the use of the Post method
:The request message syntax is incorrect and the server is not recognized
401:Request Authentication Required
403:The requested corresponding resource is forbidden to be accessed
404:The server cannot find the corresponding resource
£ ºServer Internal Error
503:The server is busy


5, HTTP1.1 version of the new features
A, the default persistent connection to save traffic, as long as the client service side does not explicitly make a disconnect TCP connection, has remained connected, can send multiple HTTP requests

B, Pipeline, the client can make multiple HTTP requests at the same time without waiting for a response

C, the principle of the continuation of the breakpoint



6. Common HTTP header Fields
A, the General header field
(header field used for both request and response messages)
Date: Create Message time
Connection: Management of connections
Cache-control: Cache Control
Transfer-encoding: Transmission encoding method of message body
B. request header Field(The header field that the request message will use)
Host: The server on which the resource is requested
Accept: Types of media that can be processed
Accept-charset: A character set that can be received
Accept-encoding: Acceptable content encoding
Accept-language: Acceptable Natural language
C, Response header field (The header field to be used for the response message)
Accept-ranges: Acceptable byte range
Location: The URI to which the client is redirected
Installation information for the SERVER:HTTP server
D, Entity header field(header field used by the entity portion of the request message and the response message)
Allow: The HTTP method supported by the resource
Content-type: Type of entity main class
Content-encoding: The encoding method that the entity body applies To
Content-language: The natural language of the entity body
Content-length: The number of bytes of the entity Principal
Content-range: The position range of the entity body, which is typically used when making partial requests


7. HTTP Disadvantages and HTTPS
A, communication using clear text is not encrypted, content may be eavesdropping
b, do not verify the identity of the communication party, may be disguised
C, unable to verify message integrity, may be tampered with

HTTPS is HTTP plus cryptographic processing (typically SSL secure communication lines) + Authentication + integrity Protection


The difference between 8.http1.1 and HTTP1.0?

Multiple HTTP requests and responses can be delivered in the same TCP connection.
Multiple requests and responses can overlap, and multiple requests and responses can be made concurrently.

More request headers and response headers (such as HTTP1.0 fields without host).


In summary, in http/1.0, most implementations use a new connection for each request/response interchange. In http/1.1, a connection can be used for one or more request/response interchanges, although the connection may be closed for various reasons. This is the biggest difference between them.


TCP has an attribute called slow start, the meaning of which can be interpreted as a general explanation: The TCP connection requires the sending side to send a certain number of network packets after the receiving end will be back to a "I received" network packets, and network packets through each router when the packet header will be rewritten, so the network does not drop packets The larger the network packet, the higher the efficiency of the network. TCP connection to find the optimal size of the network packet method is, in the initial TCP connection establishment, the size of the network packet is very small, according to network conditions, the two ends of the program will gradually increase the size of the network packet to adapt to bandwidth to improve the efficiency of network transmission. So the browser to send a request to the server, if each request to close the connection, then the data transmission of the connection is difficult to reach the speed of the bandwidth can be carried.


HTTP1.1 presents the concept of a persistent connection (persistent connection), which means that the same HTTP connection can handle multiple requests at the same time, with some mechanism to ensure the separation between requests. The specific procedure is: After the server sends a response to the browser, does not immediately close the connection, the browser to determine the response of the previous request has been completed, you can send a second request on the same connection. This mode of operation greatly reduces the network package, and experiments have shown that this approach is effective. However, because maintaining connections on the server consumes a certain amount of resources, the general server does not permanently maintain a persistent connection, and it is not recommended to establish too many persistent connections between the browser and the server.


How 9.HTTP works with TCP, how does TCP ensure a stable and orderly HTTP transmission?

Both http/1.0 and http/1.1 use TCP as the underlying transport protocol. The HTTP client initiates the establishment of a TCP connection with the server first. Once the connection is established, the browser process and the server process can access TCP through their sockets. As mentioned earlier, the client socket is the "gate" between the client process and the TCP connection, and the server-side socket is the "gate" between the server process and the same TCP connection. The customer sends an HTTP request message to his socket and receives an HTTP response message from its own socket. Similarly, the server receives an HTTP request message from its own socket and sends an HTTP response message to its own socket. Once a client or server sends a message into its own socket, the message is completely under TCP control. TCP provides a reliable data transfer service to HTTP, which means that each HTTP request message sent by the customer will eventually reach the server without compromise, and each HTTP response message sent by the server will eventually reach the customer without damage. We can see a clear advantage of layered network architectures--http don't have to worry about data loss or how TCP recovers details from data loss and sequencing. These are the tasks of the lower protocol layer in TCP and protocol stacks.


TCP also uses a congestion control mechanism. This mechanism forces each new TCP connection to start with a relatively slow rate of data transmission, but as long as the network is not congested, each connection can quickly rise to a relatively high rate. The initial phase of this slow transmission is called slow start (slow start).


It is important to note that the server does not store any state information about the customer while sending the requested file to the customer. Even if a customer requests the same object again within a few seconds, the server will not respond by saying that it has just sent the object to it. Instead, the server re-sends this object because it has completely forgotten what was done earlier. Since the HTTP server does not maintain the customer's status information, we say that HTTP is a stateless protocol (stateless protocol).


This article is from the "1" blog, please be sure to keep this source http://10808695.blog.51cto.com/10798695/1840537

Summary of questions about HTTP related polygons

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.