Knowledge of the HTTP protocol

Source: Internet
Author: User

Because today's work is designed for web development, I've learned about the HTTP protocol. After reading this article HTTP protocol specific explanation (really very classic), summed up the relevant frequently used knowledge tied here to facilitate future queries.

The main features of the HTTP protocol can be summarized such as the following:
1. Support Customer/server mode.


2. Simple high-speed: When a client requests a service from the server, it simply transmits the request method and path. The request method is often used with, and POST. Each method specifies that the customer has a different type of contact with the server.

Because the HTTP protocol is simple, it makes the program of Httpserver small, so the communication speed is very fast.
3. Flexible: HTTP agrees to transfer arbitrary types of data objects. The type being transmitted is marked by Content-type.
4. No connection: The meaning of no connection is to limit each connection to just one request. The server finishes processing the customer's request. After receiving the customer's response, the connection is disconnected. In this way, the transmission time can be saved.
5. Stateless: The HTTP protocol is a stateless protocol. Stateless means that the protocol has no memory capacity for transactional processing.

A lack of state means that assuming that the preceding information may be processed, it must be re-routed, which could result in an increase in the amount of data sent per connection. There is one more aspect. When the server does not need the previous information, it responds more quickly.


HTTP URL (a URL is a special type of URI that includes enough information to find a resource) such as the following:

http://host[":" Port][abs_path]
HTTP indicates that network resources are to be located through the HTTP protocol, and host represents a legitimate Internet host domain name or IP address. Port to specify a port number. NULL uses the default port 80;abs_path to specify the URI of the requested resource, and if Abs_path is not given in the URL, it must be given as a "/" when it is the request URI, which is usually the work browser's own initiative to help us finish.
eg
1. Input: www.guet.edu.cn
The browser actively converts itself to: http://www.guet.edu.cn/
2, http:192.168.0.116:8080/index.jsp

user-agent

When we go online to the forum, we often see some welcome information, which lists the name and version number of your operating system. The name and version number of the browser you are using, which often makes a lot of people feel fantastic, actually, the server application is getting this information from the User-agent request header domain. The User-agent request header domain agrees that the client will tell the server its operating system, browser, and other properties. It's just that. This header field is not necessary, assuming we write a browser ourselves, without using the User-agent request header domain, then the server side will not know our information.
Get the UserAgent code for the system in Android such as the following: System.getproperty ("http.agent"); Print on my Phone:
dalvik/1.6.0 (Linux; U Android 4.3; gt-i9300 build/jss15j)


Accept-encoding
HTTP header accept-encoding is the browser sent to the server, declaring the browser supports the type of encoding
Common with
Accept-encoding:compress, gzip//support for compress and gzip types
Accept-encoding://default is identity
Accept-encoding: *//support for all types of accept-encoding:compress;q=0.5, gzip;q=1.0//in order support gzip, compress
accept-encoding:gzip;q=1.0, identity; q=0.5, *;q=0//In order to support gzip, identity
The corresponding type encoding header returned by the server is the content-encoding.server that handles the accept-encoding rule for example, as seen in the following 1. Assuming that the server is able to return whatever type of Encoding is defined in accept-encoding, the processing succeeds (unless the value of Q equals 0, equals 0 is unacceptable)


Knowledge of the 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.