HTTP protocol--header Description

Source: Internet
Author: User

is the header of an HTTP request that I intercepted using the IE developer tool.

is the header of an HTTP response that I intercepted using the IE developer tool.

Header Common Directives

The header is divided into three parts: the first part is the version of the HTTP Protocol (http-version);
The second part is state code (status);
The third part is the reason phrase (reason-phrase).

Send a 200 normal response
Header (' http/1.1 OK ');

Set 404 Header: Page not found
Header (' http/1.1 404 Not Found ');

Pages are permanently deleted and can tell the search engine to update their URLs
Set Moved permanently header (Good for redrictions)
Use with location header
Header (' http/1.1 301 Moved permanently ');

Restricted access
Header (' http/1.1 403 Forbidden ');

Server error
Header (' http/1.1 Internal Server Error ');

Redirect to a new location
Redirect to a new location:
Header (' location:http://www.example.org/');

Redirect after a period of delay
Redrict with delay:
Header (' refresh:10; url=http://www.example.org/');
print ' You'll be redirected in ten seconds ';

Overwrite x-powered-by value
Override x-powered-by:php:
Header (' x-powered-by:php/4.4.0 ');
Header (' x-powered-by:brain/0.6b ');

Content language (en = 中文版)
Content language (en = 中文版)
Header (' content-language:en ');

Last modified time (can be used when caching)
Last modified (good for caching)
$time = time ()-60; or Filemtime ($FN), etc
Header (' last-modified: '. Gmdate (' d, D M Y h:i:s ', $time). ' GMT ');

Tell the browser what to get is not updated
Header for telling the browser the content
did not get changed
Header (' http/1.1 304 not Modified ');

Set the length of the content (can be used when caching):
Set content Length (good for caching):
Header (' content-length:1234 ');

To download files:
Headers for an download:
Header (' Content-type:application/octet-stream '); Header (' content-disposition:attachment; filename= ' Example.zip ');
Header (' content-transfer-encoding:binary ');

Disable caching of the current document:
Load the file to Send:readfile (' example.zip ');
Disable caching of the current document:
Header (' Cache-control:no-cache, No-store, max-age=0, Must-revalidate ');
Header (' Expires:mon, Jul 1997 05:00:00 GMT ');

To set the content type:
Date in the Pastheader (' Pragma:no-cache ');
Set Content Type:
Header (' content-type:text/html; charset=iso-8859-1 ');
Header (' content-type:text/html; Charset=utf-8 ');

Header (' Content-type:text/plain '); Plain text file
Header (' Content-type:image/jpeg '); JPG picture
Header (' Content-type:application/zip '); ZIP file
Header (' content-type:application/pdf '); PDF file
Header (' Content-type:audio/mpeg '); Audio MPEG (MP3,...) file
Header (' Content-type:application/x-shockwave-flash '); Flash Animation

Displays the Login dialog box, which can be used for HTTP authentication
Show Sign In box
Header (' http/1.1 401 Unauthorized ');
Header (' Www-authenticate:basic realm= ' Top Secret ');
print ' Text that would be displayed if the user hits cancel or ';

print ' enters wrong login data ';? >

Send a 200 normal response
Header ("http/1.1 OK");

Send a 404 resource response not found
Header (' http/1.1 404 Not Found ');

Send a 301 Permanent redirect
Header (' http/1.1 301 Moved permanently ');

Send a 503 site temporarily inaccessible
Header (' http/1.1 503 Service temporarily unavailable ');

Web redirection
Header (' location:http://www.php-chongqing.com/');

Set page redirection after 3 seconds
Header (' Refresh:3; url=http://www.php-chongqing.com/');
Echo ' webpage will jump to http://www.php-chongqing.com ' in 3 seconds;

Set page encoding
Header (' content-type:text/html; Charset=utf-8 ');

Set page output a picture stream
Header (' Content-type:image/jpeg ');

Set up a Web page to output a PDF document
Header (' content-type:application/pdf ');

Set up a ZIP document for Web page output
Header (' Content-type:application/zip ');

Responses part

Header

Solution Interpretation

Example

Accept-ranges

Indicates whether the server supports the specified range request and what kind of staging request

Accept-ranges:bytes

Age

Estimated time (in seconds, non-negative) from the original server to the proxy cache

Age:12

Allow

A valid request behavior for a network resource is not allowed to return 405

Allow:get, HEAD

Cache-control

Tell if all caching mechanisms can be cached and which type

Cache-control:no-cache

Content-encoding

The type of return content compression encoding supported by the Web server.

Content-encoding:gzip

Content-language

The language of the response body

Content-language:en,zh

Content-length

The length of the response body

content-length:348

Content-location

Alternate alternative address to request resource substitution

Content-location:/index.htm

Content-md5

Returns the MD5 checksum value of a resource

content-md5:q2hly2sgsw50zwdyaxr5iq==

content-Range

The byte position of this section in the entire return body

content-Range: bytes 21010-47021/47022

Content-type

Returns the MIME type of the content

content-type:text/html; Charset=utf-8

Date

Time the original server message was issued

Date:tue, 08:12:31 GMT

ETag

The current value of the entity label of the request variable

ETag: "737060cd8c284d8af7ad3082f209582d"

Expires

Date and time when the response expires

Expires:thu, 16:00:00 GMT

Last-modified

Requested last modified time for resource

Last-modified:tue, 12:45:26 GMT

Location

Used to redirect the receiver to the location of the non-request URL to complete the request or identify the new resource

Location: http://www.zcmhi.com/archives/94.html

Pragma

Includes implementing a specific instruction that can be applied to any receiver on the response chain

Pragma:no-cache

Proxy-authenticate

It indicates the authentication scheme and the parameters on the URL that can be applied to the proxy

Proxy-authenticate:basic

Refresh

Applied to redirect or a new resource was created, redirected after 5 seconds (proposed by Netscape, supported by most browsers)

Refresh:5; Url=

http://www.zcmhi.com/archives/94.html

Retry-after

Notifies the client to try again after a specified time if the entity is temporarily undesirable

retry-after:120

Server

Web Server Software Name

server:apache/1.3.27 (Unix) (Red-hat/linux)

Set-cookie

Set Http cookies

Set-cookie:userid=johndoe; max-age=3600; Version=1

Trailer

Indicates that the header domain is present at the end of the chunked transfer code

Trailer:max-forwards

Transfer-encoding

File transfer encoding

Transfer-encoding:chunked

Vary

Tells the downstream agent whether to use the cache response or request from the original server

Vary: *

Via

Tells the proxy client where the response was sent by

via:1.0 Fred, 1.1 nowhere.com (apache/1.1)

Warning

Warning about possible issues with the entity

warning:199 Miscellaneous Warning

Www-authenticate

Indicates the authorization scheme that the client request entity should use

Www-authenticate:basic

See website Header Field Definitions

Content-type

The requested MIME information corresponding to the entity

content-type:application/x-www-form-urlencoded

Date

Date and time the request was sent

Date:tue, 08:12:31 GMT

Expect

The specific server behavior of the request

Expect:100-continue

From

Email from the user who made the request

From: [Email protected]

Host

Specify the domain name and port number of the requested server

Host:www.zcmhi.com

If-match

Only valid if the request content matches the entity

If-match: "737060cd8c284d8af7ad3082f209582d"

If-modified-since

If the requested part is modified after the specified time, the request succeeds, and the 304 code is returned without modification

If-modified-since:sat, Oct 19:43:31 GMT

If-none-match

If the content does not change the return 304 code, the parameter is the server's previously sent ETag, and the server responded to the ETag comparison to determine whether the change

If-none-match: "737060cd8c284d8af7ad3082f209582d"

if-Range

If the entity does not change, the server sends the missing portion of the client, otherwise the entire entity is sent. The parameters are also ETag

if-Range: "737060cd8c284d8af7ad3082f209582d"

If-unmodified-since

Request succeeds only if the entity has not been modified since the specified time

If-unmodified-since:sat, Oct 19:43:31 GMT

Max-forwards

Limit the time that information is transmitted through agents and gateways

Max-forwards:10

Pragma

Used to include implementation-specific instructions

Pragma:no-cache

Proxy-authorization

Connect to an authorization certificate for the agent

Proxy-authorization:basic qwxhzgrpbjpvcgvuihnlc2ftzq==

Range

Request only part of an entity, specify a range

Range: bytes=500-999

Referer

The address of the previous page, which is immediately followed by the current request page,

Referer: http://www.zcmhi.com/archives/71.html

TE

The client is willing to accept the transfer encoding and notifies the server to accept the trailing header information

te:trailers,deflate;q=0.5

Upgrade

Specify some kind of transport protocol to the server for the server to convert (if supported)

Upgrade: HTTP/2.0, shttp/1.3, irc/6.9, rta/x11

User-agent

The content of the user-agent contains the user information that made the request

user-agent:mozilla/5.0 (Linux; X11)

Via

Notifies the intermediary gateway or proxy server address, communication protocol

via:1.0 Fred, 1.1 nowhere.com (apache/1.1)

Warning

About warning messages for message entities

warn:199 Miscellaneous Warning

Requests Part

Header

Solution Interpretation

Example

Accept

Specify what types of content clients can receive

Accept:text/plain, text/html

Accept-charset

The set of character encodings that the browser can accept.

Accept-charset:iso-8859-5

Accept-encoding

Specifies that the Web server that the browser can support returns the content compression encoding type.

Accept-encoding:compress, gzip

Accept-language

Browser-acceptable language

Accept-language:en,zh

Accept-ranges

You can request one or more child range fields for a Web page entity

Accept-ranges:bytes

Authorization

Authorization certificate for HTTP authorization

Authorization:basic qwxhzgrpbjpvcgvuihnlc2ftzq==

Cache-control

Specify the caching mechanism that requests and responses follow

Cache-control:no-cache

Connection

Indicates whether a persistent connection is required. (HTTP 1.1 defaults to persistent connection)

Connection:close

Cookies

When an HTTP request is sent, all cookie values stored under that request domain are sent to the Web server.

Cookie: $Version = 1; Skin=new;

Content-length

The requested content length

content-length:348

Reprint Address: http://www.cnblogs.com/breezemist/p/3483777.html

HTTP protocol--header Description

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.