Knowledge about HTTP

Source: Internet
Author: User

Because of the current design of web development, I have learned about the HTTP protocol. After reading the HTTP protocol details (Classic) in this article, I summarized the common knowledge and used it to facilitate future queries.

The main features of HTTP are as follows:
1. Supports the customer/Server mode.
2. simple and fast: when a customer requests a service from the server, they only need to send the request method and path. Common Request methods include get, Head, and post. Each method specifies the type of contact between the customer and the server. Because the HTTP protocol is simple, the program size of the HTTP server is small, so the communication speed is fast.
3. Flexibility: HTTP allows transmission of any type of data objects. The type being transferred is marked by Content-Type.
4. No connection: No connection means that only one request is allowed for each connection. After the server processes the customer's request and receives the customer's response, the connection is disconnected. This method can save transmission time.
5. Stateless: HTTP is stateless. Stateless means that the Protocol has no memory for transaction processing. The lack of status means that if subsequent processing requires the previous information, it must be re-transmitted, which may increase the amount of data transmitted each connection. On the other hand, when the server does not need previous information, its response is faster.


HTTP URL(A URL is a special type of URI that contains sufficient information for searching a resource.) The format is as follows:

http://host[":"port][abs_path]
HTTP indicates that network resources are to be located through the HTTP protocol; host indicates a valid Internet host domain name or IP address; port specifies a port number. If it is null, the default port 80 is used; abs_path specifies the URI of the requested resource. If abs_path is not provided in the URL, it must be given in the form of "/" when it is used as the request URI. Generally, this work is automatically completed by the browser.
Eg:
1. Enter www.guet.edu.cn
The browser automatically converts to: http://www.guet.edu.cn/
2. http: 192.168.0.116: 8080/index. jsp

User-Agent

When we log on to the forum online, we will often see some welcome information, which lists the names and versions of your operating system, the names and versions of your browsers, this is often amazing for many people. In fact, the server application obtains this information from the User-Agent Request Header domain. The User-Agent request header field allows the client to tell the server its operating system, browser, and other attributes. However, this header field is not required. If we write a browser and do not use the User-Agent to request the header field, the server will not be able to know our information.
The useragent code for obtaining the system in Android is as follows: system. getproperty ("HTTP. Agent"); printed on my mobile phone:
Dalvik/1.6.0 (Linux; U; Android 4.3; GT-I9300 build/jss15j)


Accept-Encoding
In the HTTP header, accept-encoding is the encoding type supported by the browser and sent to the server.
Common
Accept-encoding: compress, Gzip // supports compress and Gzip
Accept-encoding: // The default value is identity.
Accept-encoding: * // supports all types of accept-encoding: compress; q = 0.5, Gzip; q = 1.0 // supports gzip and compress in sequence
Accept-encoding: gzip; q = 1.0, identity; q = 0.5, *; q = 0 // supports gzip and identity in sequence
The corresponding type encoding header returned by the server is content-encoding. the rules for the server to process accept-encoding are as follows: 1. if the server can return any type of encoding defined in accept-encoding, the processing is successful (unless the value of Q is equal to 0 and 0 represents unacceptable)


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.