HTTP Protocol Basics

Source: Internet
Author: User

The main features of the HTTP protocol can be summarized as follows:

1. Support client/server mode.

2. Simple and fast: When a customer requests a service from the server, it simply transmits the request method and path . The request method commonly has get, HEAD, POST. Each method specifies a different type of contact between the customer and the server. Because the HTTP protocol is simple, the HTTP server's program size is small, so the communication speed is fast.

3. Flexible: HTTP allows the transfer of any type of data object. The type being transmitted is marked by Content-type.

4. No connection : The meaning of no connection is to limit the processing of only one request per connection. When the server finishes processing the customer's request and receives the customer's answer, 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 if the previous information is required for subsequent processing, it must be re-routed, which may cause the amount of data to be transferred per connection to increase. On the other hand, it responds faster when the server does not need the previous information.

URL structure

HTTP (Hypertext Transfer Protocol) is a request- and-response mode-based, stateless, application-level protocol , often based on TCP connection, HTTP1.1 version of a continuous connection mechanism, the vast majority of web development, is built on the HTTP protocol on the Web Application.

The HTTP URL (url is a special type of URI that contains enough information to find a resource) in the following format:

http://host[":" Port][abs_path]. HTTP means to locate network resources through the HTTP protocol, the host represents a legitimate Internet host domain name or IP address; port specifies a port number, or null specifies the URI of the requested resource using the default port 80;abs_path, if no abs_ is given in the URL Path, it must be given as a "/" when it is a request URI, which is usually done automatically by the working browser.

eg

1. Input: www.guet.edu.cn

Browser automatically converted to: http://www.guet.edu.cn/

HTTP Request Type:

The request line begins with a method symbol, separated by a space, followed by the URI of the request and the version of the Protocol, in the following format: Methodrequest-uri http-version Crlf where method represents the request approach; Request-uri is a Uniform resource identifier Http-version represents the HTTP protocol version of the request, and CRLF represents carriage return and newline (except for the end of CRLF, a separate CR or LF character is not allowed).

There are several ways to request a method (all uppercase), and each method is interpreted as follows:

Response Status Code:

The status code consists of three digits, the first number defines the category of the response, and there are five possible values:

1XX: Indication information--Indicates that the request has been received and continues processing

2XX: Success-Indicates that the request has been successfully received, understood, accepted

3XX: Redirect--further action is required to complete the request

4XX: Client Error--Request syntax error or request not implemented

5XX: Server-side error-the server failed to implement a legitimate request

Common status codes, status descriptions, descriptions:

200:ok//Client request succeeded

400:bad request//client requests have syntax errors and cannot be understood by the server

401:unauthorized//Request unauthorized, this status code must be used with the Www-authenticate header field

403:forbidden//server receives request, but refuses to provide service

404:not Found//Request resource not present, eg: Wrong URL entered

500:internal Server error//server unexpected errors

503:server unavailable//The server is currently unable to process client requests and may return to normal after a period of time

eg:http/1.1 OK (CRLF)

2. The response header is described later

3, the response body is the contents of the resources returned by the server

HTTP Protocol Basics

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.