HTTP protocol Message • Method • Status Code

Source: Internet
Author: User
Tags string format browser cache

Points

1. Main features of the HTTP protocol 2. Part of the HTTP message 3. HTTP Method 4. The difference between POST and get 5. Main features of HTTP status Code "summary" HTTP protocol

Main features: Simple fast, flexible, no connection (non-keep-alive), no State

    • Each resource URI is fixed, and if you want to access a resource, enter the URI in the browser.
    • Flexible: HTTP allows any type of data object to be transmitted, and the type being transmitted is marked by Content-type.
    • 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.
    • Stateless: means that the protocol has no memory capacity for transactional processing. Subsequent processing needs to be re-transmitted when the previous information is required.

"Supplemental" What is a URI? What is a URL? What's the difference?

Simple summary:

uri--Uniform Resource Identifiers

URL (Uniform Resource Locator): The Uniform Resource Locator is also sometimes referred to as the web address.

URL is a subset of URIs

  

HTTP message composition

The information used for HTTP protocol interaction is called an HTTP message.

    • The HTTP message on the request side is called the request message :
      • Request Line: Contains the HTTP method, request URI, and HTTP version
      • Request Header: Key:value contains a variety of headers that represent the various conditions and attributes of the request and response
      • Blank line: Tell the server that the requester is next.
      • Request Body

Such as:

    • The response end is called the response message :
      • Status line: Contains status codes, reason phrases, and HTTP versions that indicate the result of the response
      • Response header,
      • Blank Line,
      • Response Body: ...

HTTP method
    • POST: Transfer Entity content resources
    • Get: Get Resources
    • PUT: Updating resources
    • HEAD: Get message header
    • Delet: Deleting files

"Test Center : What is the difference between post and get?" "(Remember 3-5)

    • Get is harmless when the browser is rolled back, and post submits the request again.
    • Get generated URL address can be bookmark, and post is not available.
    • The GET request will be active by the browser cache, and post will not, unless manually set.
    • The GET request parameters are kept intact in the browser history, and the parameters in the post are not retained.
    • A GET request has a length limit for the parameters that are passed in the URL (2kb different browsers will also vary), and post does not.
    • For data types of parameters, get accepts only ASCII characters, while Post has no restrictions.
    • Get is less secure than post, because parameters are directly exposed to URLs, so they cannot be used to pass sensitive information.
    • The get parameter is passed through the URL and the post is placed in request body.
    • A GET request can only be URL-encoded-encodeuricomponent (), while post supports multiple encoding methods.

The format of the "supplemental" post data is the same as the query string format, and if you need to serialize the data for the form in the page and then send it to the server via XHR, you can use the Serialize () function to create the string, which is the form serialization

HTTP status Code

Need to remember some of the frequently encountered, other status code can consult the HTTP status Code document

    • 1xx: Indicates information, request in Process
    • 2xx: Request normal receive
      • 200:ok
      • 206: "Partial Content" response: The client sends a range A GET request for a request header is a resource that indicates that it only needs a portion of the URL, and the server finishes it. For example, when video audio plays a very large visual/audio address, it typically returns 206
    • 3xx: redirect requires additional action to complete the request
      • 301: Permanent redirection, the requested page has been moved to the new URL
      • 302: Temporary redirect
      • 304: Cache, the server tells the browser to use the cache directly, without requesting the server
    • 4xx (client error)
      • 4 00: Client syntax error
      • 401: Request authorization failed
      • 403: Request not allowed forbidden resource forbidden access
      • 404: No files, queries, or URLs found
    • 5xx (server-side error)
      • 500: Server Unpredictable error
      • 501: "Internal server Error" server side error occurred while executing the request, the server is not working properly
      • 503: The server is currently unable to process client requests for temporary overloads and when the machine
      • 504: Server is not connected
      • 505: The server does not support or deny HTTP versions specified in the request header
    • /ul>

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.