[Http] the http method, status code, and composition.

Source: Internet
Author: User
Tags error status code http authentication

[Http] the http method, status code, and composition.
Http (Hypertext Transfer Protocol)

HyperText Transfer Protocol (Hyper Text Transfer Protocol) is a Transfer Protocol used to Transfer HyperText from a WWW server to a local browser. It makes the browser more efficient and reduces network transmission. It not only ensures that the computer transfers hypertext documents correctly and quickly, but also determines which part of the transmitted documents and which part of the content is first displayed (such as text before graphics.

The information used for http protocol interaction is called http packets. The http packet of the request end (client) is called the request message, and the http packet of the response end (server) is called the Response Message.

The Request Message consists of the Request Method, request URI, Protocol version, header field (optional), and content entity (optional ).

The Response Message consists of the Protocol version, status code, cause phrase, header field (optional), and entity.

 

In each packet, the request URI, Protocol version, status code, reason phrase, and header field belong to the packet header, and then empty a line. The rest is the packet subject.

There are four types of header fields: request header field, response header field, General header field, entity header field, and general header and entity header are available in both request message and Response Message, the request header only contains the request message, and the response header only contains the Response Message.

 

A packet is a basic unit in http Communication. It consists of eight byte streams and is transmitted over http.

The entity is transmitted as the request and response payload data (Supplemental item). Its content consists of the entity header and entity body.

Generally, the message body is equal to the entity body. The content of the entity body changes only when the encoding operation is performed during transmission, which is inconsistent with the message body.

 

Methods supported by http1.0 and http1.1

Method

Description

Supported http versions

GET

Obtain a resource identified by a URI

1.0, 1.1

POST

Transmission entity

1.0, 1.1

PUT

Transfer file (without verification mechanism)

1.0, 1.1

HEAD

Obtain the packet header

1.0, 1.1

DELETE

Delete files (without authentication mechanism)

1.0, 1.1

OPTIONS

Question Support Method

1.1

TRACE

Tracing path

1.1

CONNECT

Require a tunneling protocol connection proxy

1.1

LINK

Establish connections with resources

1.0

UNLINK

Disconnected

1.0

 

 

 

Http status code

Status Code

Category

Reason phrase

1XX

Informational (Information Status Code)

The received request is being processed.

2XX

Success (Success status code)

Request processed

3XX

Redirection (Redirection status code)

Additional operations are required to complete the request

4XX

Client Error (Client Error status code)

The server cannot process the request.

5XX

Server Error (Server Error status code)

An error occurred while processing the request on the server.

 

Common status codes in 14

200 OK

The request sent from the client is processed properly on the server.

204 No Content

Indicates that the request received by the server has been processed successfully, but the returned response message does not include the entity body.

206 Partial Content

Indicates that the client has performed a range request, and the server has successfully executed the GET request.

301 Moved Permaently

Permanent redirection indicates that the requested resource has been assigned a new URI, and the requested resource URI should be used later

302 Found

Temporary redirection indicates that the requested resource has been assigned a new URI.

303 See Other

Indicates that the requested resource should be obtained using the GET method because the resource corresponding to the request has another URI.

304 Not Modified

Indicates that when the client sends a conditional request, the server allows the request to access the resource. However, if the request meets the conditions, 304 Not Modified is returned directly (the server resource is changed, you can directly use the principal part that has not expired on the client)

307 Temporary Redirect

Temporary redirection, which has the same meaning as 302

400 Bad Request

Indicates a syntax error in the request message. The server cannot identify the request

401 Unauthorized

Indicates the authentication information for the request to pass http authentication. If a request has been made before, the user authentication fails.

403 Forbidden

Indicates that access to the requested resource is rejected by the server. No access permission

404 Not Found

Indicates that the server cannot find the requested resource, that is, the requested resource does not exist.

500 Internal Server Error

Indicates that an error occurs when the server executes the request, or a web application may have a bug or some temporary faults.

503 Service Unavailable

Indicates that the server is temporarily overloaded or is being shut down for maintenance, and the request cannot be processed now

 

 

Http common header field

Common header field name

Description

Cache-Control

Control cache behavior

Connection

Manage skip-by-hop headers and persistent connections

Date

The date and time when the message was created.

Pragma

Message instructions

Trailer

Overview of the header at the end of the message

Transfer-Encoding

Transmission Encoding Method of the specified message body

Upgrade

Upgrade to another protocol to check whether higher version protocol communication is available

Via

Information about the proxy server, tracing the transmission path of request and response packets between the client and the server

Warning

Error Notification, which usually notifies users of warnings about cache-related problems.

 

Http1.1 Warning codes (seven Warning types)

Warning code

Warning content

Description

110

Response is stale (Response has expired)

The proxy returns expired resources.

111

Revalidation failed (re-verification failed)

An error occurred while the agent was unable to verify the resource validity (the server could not arrive, and other reasons)

112

Disconnection operation)

The proxy and Internet connection are deliberately cut off

113

Heuristic expiration (tentative expiration)

Response validity period exceeds 24 hours (when the effective cache is set to be greater than 24 hours)

199

Miscellaneous warning (Miscellaneous warning)

Any warning content

214

Tansformation applied (conversion is used)

When the proxy processes Content Encoding or media types

299

Miscellaneous persistent warning (persistent Miscellaneous warning)

Arbitrary warning content

 

 

Http request header field

Request Header field

Description

Accept

Media types that the user agent can process and their relative priority

Accept-Charset

Priority Character Set, Character Set supported by the user agent, and relative priority

Accept-Encoding

Priority encoding, Content Encoding supported by the user agent, and priority order

Accept-Language

Preferred language, the natural language that the user agent can process, and the relative priority of the Natural Language Set

Authorization

Web authentication information

Secondary CT

Expect specific server Behavior

From

User's email address

Host

Server where the requested resource is located (host name and port number)

If-Match

Compared with the object tag (ETag), if the request is the same, the request is executed. Otherwise, the 412 status code is returned.

If-Modefied-Since

If the If-Modefied-Since field value is earlier than the resource Update time, you want to process the request. Otherwise, the 304 status code is returned.

If-None-Match

Compare object tags (reverse Match with If-Match)

If-Range

When the resource is not updated, the system sends a request for the object Byte range. If the If-Range field value is consistent with the ETag value or time of the requested resource, the request is processed as a Range request. Otherwise, all resources are returned.

If-Unmodified-Since

Compare the resource Update Time (If-Modified-Since wants to reverse)

Max-Forwards

Maximum number of hops for transmission (specify the maximum number of servers that can pass through in decimal format)

Proxy-Authorization

The proxy server requires client authentication information

Range

Object byte range request

Referer

The original accessor Of The URI in the request (the URI of the requested original resource)

TE

Inform the Server client of the Transmission Encoding Method and relative priority of the response.

User-Agent

Http client program information

 

 

Http response header field

Response Header field

Description

Accept-Ranges

Whether to accept byte range requests

Age

Resource Creation Time, in seconds

ETag

Resource matching information to notify the client entity ID

Location

Redirects the client to a specified URI

Proxy-Authenticate

Authentication information of the proxy server to the client

Retry-After

Requirements on the time when a request is initiated again

Server

Http Server installation information

Vary

Proxy Server Cache Management Information

WWW-Authenicate

Authentication information of the server to the client

 

 

Http object header field

Object header field

Description

Allow

Http methods supported by resources

Content-Encoding

Entity encoding method

Content-Language

Natural Language of Entity

Content-Length

Object size (in bytes)

Content-Location

Replace the URI of the corresponding resource

Content-MD5

Object Body message digest

Content-Range

Object subject location range

Content-Type

Media type of the Entity

Expires

Object subject expiration date and time

Last-Modified

Date and time when the resource was last modified

Related Article

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.