HTTP Protocol (2)

Source: Internet
Author: User

First, the URL

HTTP is a TCP-based application-layer protocol in which the HTTP1.1 version supports a continuous connection mechanism (keep-alive), and the vast majority of WEB development is HTTP-based.

The URL of an HTTP is a special Uri,uri that uniquely identifies a resource, but does not necessarily find the resource through a URI, and the URL contains all the information that finds the resource, where the resource can be found by URL.

The URL format is:, http://host[‘:‘port][abs_path] which http represents the HTTP protocol to locate network resources, host representing a legitimate domain name or IP, port for the service port, usually is the URI of the abs_path requested resource, if the URL is not given So when it has to be / given in the form of a request URI, usually the browser will do the work for us.

such as: Input www.baidu.com , the browser will automatically convert to http://www.baidu.com/ .

Second, HTTP request

Request message: Request line, request header, request body

1. Request Line

Request Line Format:方法 + URI + 版本

    1. Methods (method)

      The difference between GET and POST: TODO

      1. GET:
      2. POST:
    2. Uri

      A URI is a uniform resource identity, which is a unique identifier for a resource on the server.

    3. Versions (version)

      The http/1.1 version is now generally used.

2. Request Header

The request header contains additional information that the client carries when it passes the request to the server, including information about the client itself.

    1. The contents of the request header are as follows:

3. Request Body

The request body is not required for a GET request, and for a POST request, the content of the request needs to be carried in the request body, such as when multiple sets of pictures are requested, and the request is placed in the request body.

Third, HTTP response

The HTTP response message is actually similar to the structure of the HTTP request message, including: status line, response header, response body.

1. Status line

Status line format:版本 + 状态码 + 说明

    1. Versions (version)

      The http/1.1 version is now generally used.

    2. Status Code and description

2. Response header

In addition to the status line, the server is required to carry information about the next access to the resource identified by Request-uri and the server itself, which is placed in the response header.

    1. Common response Headers

Iv. examples of HTTP message interactions
    1. Request message

    2. Response message

HTTP Protocol (2)

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.