HTTP protocol and Status Code summary

Source: Internet
Author: User
Tags error status code unsupported

HTTP protocol, the Hypertext Transfer Protocol (Hypertext Transfer Protocol). Is a rule that specifies the communication between the browser and the World Wide Web (WWW-Wide) server, which transmits the data transfer Protocol of the World Wide Web document over the Internet.

HTTP is an application-layer protocol that consists of requests and responses and is a standard client server model. HTTP is a stateless protocol.

Characteristics

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

    1. Supports client/server mode. Support Basic authentication and security certification.
    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, 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. HTTP 0.9 and 1.0 use non-persistent connections: Restrict each connection to only one request, the server finishes processing the customer's request, and then receives the customer's answer, which disconnects the connection. In this way, the transmission time can be saved. HTTP 1.1 uses persistent connections: You do not have to create a new connection for each Web object, and one connection can transfer multiple objects.
    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.
Work flow

An HTTP operation is called a transaction, and its working process can be divided into four steps:

    1. First the client and the server need to establish a connection. As soon as you click on a hyperlink, the HTTP work begins.
    2. After the connection is established, the client sends a request to the server in the form of a Uniform Resource Identifier (URL), a protocol version number, followed by MIME information including the request modifier, client information, and possible content.
    3. After the server receives the request, it gives the corresponding response information in the form of a status line, including the protocol version number of the information, a successful or incorrect code, followed by MIME information including server information, entity information, and possible content.
    4. The information returned by the client receiving server is displayed by the browser on the user's display, and then the client disconnects from the server.
      If an error occurs in one of the steps above, the information that generates the error is returned to the client, with the display output. For the user, these processes are done by HTTP itself, the user just click with the mouse, waiting for information to display it.
Header field

Each header field consists of a domain name, a colon (:), and a domain value of three parts. Domain names are case-insensitive, you can add any number of whitespace before the domain value, and the header field can be expanded to multiple lines, at the beginning of each line, with at least one space or tab.

* Request Information

The request information is sent in the following format:

    • The request line-for example, Get/images/logo.gif http/1.1-Represents a request logo.gif this file from the/images directory.
    • Request headers-for example Accept-language:en
    • Blank Line
    • Optional message body-the request line and header must end with <CR><LF> (that is, enter and then wrap). There must be only <CR><LF> in the empty line and no other spaces. In the http/1.1 protocol, all request headers, except post, are optional.
* Request method

The http/1.1 protocol defines eight methods (sometimes called "actions") to indicate the different modes of operation of the Request-uri specified resources:

    • Options-Returns the HTTP request method that the server supports for a specific resource. You can also test the functionality of your server with a request to send a ' * ' to the Web server.
    • The head-asks the server for a response that is consistent with the GET request, except that the response body will not be returned. This method allows you to obtain meta information contained in the response message header without having to transmit the entire response content. This method is commonly used to test the validity of hyperlinks, whether they can be accessed, and whether they have been updated recently.
    • GET-Makes a request to a specific resource. Note: The Get method should not be used in operations that produce "side effects", such as in Web apps. One of the reasons is that get can be accessed by web spiders and other casual.
    • POST-submits data to the specified resource for processing requests (such as submitting a form or uploading a file). The data is included in the request body. A POST request may result in the creation of new resources and/or modification of existing resources.
    • PUT-uploads its latest content to the specified resource location.
    • Delete-the request server deletes the resource identified by the Request-uri.
    • trace-echo the request received by the server, primarily for testing or diagnostics.
    • The connect-http/1.1 protocol is reserved for proxy servers that can change connections to pipelines.
    • PATCH-Used to apply local modifications to a resource, added to the canonical RFC5789.
* Response Information

The client sends a request to the server that responds with a status line that includes the version of the message protocol, the success or error encoding, the server information, the entity meta information, and the necessary entity content. Depending on the category of the response category, the server response can contain entity content, but not all responses have entity content.

* Response Header Field

The server needs to pass on a lot of additional information that cannot be placed entirely in the status line. Therefore, the response header field needs to be defined separately to describe the additional information. The response header field mainly describes the server's information and Request-uri information.

*http Common Request Headers
    • If-modified-since
    • If-none-match
    • Pragma
    • Cache-control
    • Accept
    • Accept-encoding
    • Accept-language
    • Accept-charset
    • User-agent
    • Content-type
    • Referer
    • Connection
    • Host
    • Cookies
    • Content-length
    • Authorization
    • Ua-pixels,ua-color,ua-os,ua-cpu
    • From
    • Range
*http Common Response Headers
    • Allow
    • Date
    • Expires
    • P3p
    • Set-cookie
    • ETag
    • Last-modified
    • Content-type
    • Content-range
    • Content-length
    • Content-encoding
    • Content-language
    • Server
    • X-aspnet-version
    • X-powered-by
    • Connection
    • Location
    • Refresh
    • Www-authenticate
Status code
  • 1XX Information Alert Status code
    • Continue (continued)
    • 101 Switching protocols (switching protocol)
  • 2XX Success Status Code
    • OK
    • 201 Created (created)
    • 202 Accepted (accepted)
    • 203 non-authoritative Information (non-authoritative information)
    • 204 no content (no contents)
    • 205 Reset Content (reset contents)
    • 206 Partial content (partial)
  • 3XX REDIRECT Status code
    • Multiple Choices (multiple options)
    • 301 Moved permanently (permanently removed)
    • 302 Found (found)
    • 303 See other
    • 304 not Modified (unmodified)
    • 305 use proxy (using proxies)
    • 306 not used
    • 307 temporary Redirect (temporary redirect)
  • 4XX Client Error status code
    • Bad Request
    • 401 Unauthorized (Unauthorized)
    • 402 Payment Required (requires payment)
    • 403 Forbidden (Forbidden)
    • 404 Not Found (not found)
    • 405 Method Not allowed (methods not allowed)
    • 406 not A Cceptable (unacceptable)
    • 407 Proxy authentication Required (requires proxy authentication)
    • 408 Request Timeout (Request timed out)
    • 409 Conflict (conflict)
    • 410 Gone (disappeared)
    • 411 length Required (requires length indication)
    • 412 precondition Failed (prerequisite failed)
    • 413 Request entity Too Large (requesting entities too large)
    • 414 request URI Too long (request URI too long)
    • 415 Unsupported Med IA type (Unsupported media type)
    • 416 requested range not satisfiable (the requested range is not met)
    • 417 expectation Failed (unable to meet expectations)
  • 5XX Server Error Status code
    • Internal Server error (internal server errors)
    • 501 Not implemented (not implemented)
    • 502 Bad Gateway (gateways fail)
    • 503 Service Unavailable (not available)
    • 504 Gateway Timeout (Gateway timed out)
    • 505 HTTP version not supported (HTTP versions not supported)

HTTP protocol and Status Code summary

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.