HTTP Essentials Overview: Three, client and server, request and response

Source: Internet
Author: User

One, client and server:

The HTTP protocol is primarily used for communication between clients and servers.

1, client: request access to one end of the resource. (Know why C means the client?)

2, Server: Provides one end of a resource response.

Two computers communicating using the HTTP protocol, on one communication line, must have one end as the client and the other end as the server. As a matter of fact, between two computers as a server or client role may be interchangeable, in terms of a communication line (remember as if the channel, information Channels) client and server roles are fixed, and HTTP can clearly distinguish which is the client, That's the server.

Two, request and response:

Communication is reached between the client and the server through the exchange of requests and responses. (That's very good)

The HTTP protocol specifies that the request is made from the client and the last server-side response should be requested and returned. Therefore, the communication must first be started from the client, and the server will not send a response until the request is received.

(There is no thought of nsurlrequest,nsurlresponse)

1, Request message Format:

A, method: The following will detail

B,uri: Uniform Resource Locator

C, Request the Header field (header fields, intimate bar, many places will not tell you that is it):

Force insert

4 Types of header fields

    • Universal Header Field (General header fields)
    • Requested header field (Request header fields)
    • Response Header field (Response header fields)
    • Entity header field: header for the entity portion of the request message and Response message, supplementing the resource content update time with entity-related information

D, Entity content, data and parameters, etc.

2, the format of the response (Response):

A, protocol version

B, Status code: The following will be detailed; 2xx,3xx,4xx,5xx

C, reason phrase (reason-phrase): A simple description of the reason for success/failure

D, header fields: Some additional information about the response, date, content size, content format, and so on.

E, entities (entity body): The returned data, and so on.

HTTP Essentials Overview: Three, client and server, request and response

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.