1 HTTP protocol

Source: Internet
Author: User
Tags response code

1. Four-layer model

+

2.socket

3.http protocol

      

    

4. HTTP requests

Following Sina's homepage, let's summarize the process of the HTTP request:

3.1.1 Step 1: The browser sends an HTTP request to the server first, and the request includes:

Method: Get or Post,get only request resources, Post will be accompanied by user data;

Path:/full/url/path;

Domain name: specified by the Host header: Host:www.sina.com

and other relevant headers;

If it is post, then the request also includes a body containing the user data

3.1.1 Step 2: The server returns an HTTP response to the browser, and the response includes:

Response code: 200 indicates success, 3xx indicates redirection, 4xx indicates that the client sent a request error, 5xx indicates server-side processing error occurred;

Response type: specified by Content-type;

and other relevant headers;

Usually the server's HTTP response will carry content, that is, a body, containing the content of the response, the HTML source of the Web page is in the body.

3.1.1 Step 3: If the browser still needs to continue to request additional resources from the server, make the HTTP request again, repeat steps 1, 2.

The HTTP protocol used by the web uses a very simple request-response pattern, which greatly simplifies development. When we write a page, we only need to send the HTML in the HTTP request, no need to consider how to include pictures, videos, etc., if the browser needs to request pictures and videos, it will send another HTTP request, so an HTTP request only processes one resource ( This can be understood as a short connection in the TCP protocol, with each link acquiring only one resource, if multiple links need to be established.

The HTTP protocol is also very extensible, although the browser is requesting the http://www.sina.com homepage, but Sina in HTML can be linked to other server resources, for example , so that the request pressure spread across the server, and a site can link to other sites, Countless sites link up with each other, forming the world Wide Web, referred to as www.

1 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.