`
hideto
  • 浏览: 2649662 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

HTTP1.1 Notes 8, Header Field Definitions

阅读更多
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14

Accept
The Accept request-header field can be used to specify certain media types which are acceptable for the response

       Accept         = "Accept" ":"
                        #( media-range [ accept-params ] )

       media-range    = ( "*/*"
                        | ( type "/" "*" )
                        | ( type "/" subtype )
                        ) *( ";" parameter )
       accept-params  = ";" "q" "=" qvalue *( accept-extension )
       accept-extension = ";" token [ "=" ( token | quoted-string ) ]

Accept-Charset
The Accept-Charset request-header field can be used to indicate what character sets are acceptable for the response

      Accept-Charset = "Accept-Charset" ":"
              1#( ( charset | "*" )[ ";" "q" "=" qvalue ] )

Accept-Encoding
The Accept-Encoding request-header field is similar to Accept, but restricts the content-codings that are acceptable in the response

       Accept-Encoding  = "Accept-Encoding" ":"

                          1#( codings [ ";" "q" "=" qvalue ] )
       codings          = ( content-coding | "*" )

Accept-Language
The Accept-Language request-header field is similar to Accept, but restricts the set of natural languages that are preferred as a response to the request

       Accept-Language = "Accept-Language" ":"
                         1#( language-range [ ";" "q" "=" qvalue ] )
       language-range  = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )

Accept-Ranges
The Accept-Ranges response-header field allows the server to indicate its acceptance of range requests for a resource

          Accept-Ranges     = "Accept-Ranges" ":" acceptable-ranges
          acceptable-ranges = 1#range-unit | "none"

Age
The Age response-header field conveys the sender's estimate of the amount of time since the response (or its revalidation) was generated at the origin server

           Age = "Age" ":" age-value
           age-value = delta-seconds

Allow
The Allow entity-header field lists the set of methods supported by the resource identified by the Request-URI

           Allow   = "Allow" ":" #Method

Authorization
A user agent that wishes to authenticate itself with a server--usually, but not necessarily, after receiving a 401 response--does so by including an Authorization request-header field with the request

          Authorization  = "Authorization" ":" credentials

Cache-Control
The Cache-Control general-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain

    Cache-Control   = "Cache-Control" ":" 1#cache-directive

    cache-directive = cache-request-directive
         | cache-response-directive

    cache-request-directive =
           "no-cache"                         
         | "no-store"                         
         | "max-age" "=" delta-seconds        
         | "max-stale" [ "=" delta-seconds ]  
         | "min-fresh" "=" delta-seconds      
         | "no-transform"                     
         | "only-if-cached"                   
         | cache-extension                    

     cache-response-directive =
           "public"                              
         | "private" [ "=" <"> 1#field-name <"> ]
         | "no-cache" [ "=" <"> 1#field-name <"> ]
         | "no-store"                            
         | "no-transform"                        
         | "must-revalidate"                     
         | "proxy-revalidate"                    
         | "max-age" "=" delta-seconds           
         | "s-maxage" "=" delta-seconds          
         | cache-extension                       

    cache-extension = token [ "=" ( token | quoted-string ) ]

Connection
The Connection general-header field allows the sender to specify options that are desired for that particular connection and MUST NOT be communicated by proxies over further connections

       Connection = "Connection" ":" 1#(connection-token)
       connection-token  = token

Content-Encoding
The Content-Encoding entity-header field is used as a modifier to the media-type

       Content-Encoding  = "Content-Encoding" ":" 1#content-coding

Content-Language
The Content-Language entity-header field describes the natural language(s) of the intended audience for the enclosed entity

       Content-Language  = "Content-Language" ":" 1#language-tag

Content-Length
The Content-Length entity-header field indicates the size of the entity-body, in decimal number of OCTETs, sent to the recipient or, in the case of the HEAD method, the size of the entity-body that would have been sent had the request been a GET

       Content-Length    = "Content-Length" ":" 1*DIGIT

Content-Location
The Content-Location entity-header field MAY be used to supply the resource location for the entity enclosed in the message when that entity is accessible from a location separate from the requested resource's URI

       Content-Location = "Content-Location" ":"
                         ( absoluteURI | relativeURI )

Content-MD5
The Content-MD5 entity-header field, as defined in RFC 1864 [23], is an MD5 digest of the entity-body for the purpose of providing an end-to-end message integrity check (MIC) of the entity-body

        Content-MD5   = "Content-MD5" ":" md5-digest
        md5-digest   = <base64 of 128 bit MD5 digest as per RFC 1864>

Content-Range
The Content-Range entity-header is sent with a partial entity-body to specify where in the full entity-body the partial body should be applied

       Content-Range = "Content-Range" ":" content-range-spec

       content-range-spec      = byte-content-range-spec
       byte-content-range-spec = bytes-unit SP
                                 byte-range-resp-spec "/"
                                 ( instance-length | "*" )

       byte-range-resp-spec = (first-byte-pos "-" last-byte-pos)
                                      | "*"
       instance-length           = 1*DIGIT

Content-Type
The Content-Type entity-header field indicates the media type of the entity-body sent to the recipient or, in the case of the HEAD method, the media type that would have been sent had the request been a GET

       Content-Type   = "Content-Type" ":" media-type

Date
The Date general-header field represents the date and time at which the message was originated, having the same semantics as orig-date in RFC 822

       Date  = "Date" ":" HTTP-date

ETag
The ETag response-header field provides the current value of the entity tag for the requested variant

      ETag = "ETag" ":" entity-tag

Expect
The Expect request-header field is used to indicate that particular server behaviors are required by the client

      Expect       =  "Expect" ":" 1#expectation

      expectation  =  "100-continue" | expectation-extension
      expectation-extension =  token [ "=" ( token | quoted-string )
                               *expect-params ]
      expect-params =  ";" token [ "=" ( token | quoted-string ) ]

Expires
The Expires entity-header field gives the date/time after which the response is considered stale

      Expires = "Expires" ":" HTTP-date

From
The From request-header field, if given, SHOULD contain an Internet e-mail address for the human user who controls the requesting user agent

       From   = "From" ":" mailbox

Host
The Host request-header field specifies the Internet host and port number of the resource being requested, as obtained from the original URI given by the user or referring resource

       Host = "Host" ":" host [ ":" port ]

If-Match
The If-Match request-header field is used with a method to make it conditional

       If-Match = "If-Match" ":" ( "*" | 1#entity-tag )

If-Modified-Since
The If-Modified-Since request-header field is used with a method to make it conditional: if the requested variant has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message-body

       If-Modified-Since = "If-Modified-Since" ":" HTTP-date

If-None-Match
The If-None-Match request-header field is used with a method to make it conditional

       If-None-Match = "If-None-Match" ":" ( "*" | 1#entity-tag )

If-Range
If a client has a partial copy of an entity in its cache, and wishes to have an up-to-date copy of the entire entity in its cache, it could use the Range request-header with a conditional GET

        If-Range = "If-Range" ":" ( entity-tag | HTTP-date )

If-Unmodified-Since
The If-Unmodified-Since request-header field is used with a method to make it conditional

      If-Unmodified-Since = "If-Unmodified-Since" ":" HTTP-date

Last-Modified
The Last-Modified entity-header field indicates the date and time at which the origin server believes the variant was last modified

       Last-Modified  = "Last-Modified" ":" HTTP-date

Location
The Location response-header field is used to redirect the recipient to a location other than the Request-URI for completion of the request or identification of a new resource

       Location       = "Location" ":" absoluteURI

Max-Forwards
The Max-Forwards request-header field provides a mechanism with the TRACE and OPTIONS methods to limit the number of proxies or gateways that can forward the request to the next inbound server

       Max-Forwards   = "Max-Forwards" ":" 1*DIGIT

Pragma
The Pragma general-header field is used to include implementation- specific directives that might apply to any recipient along the request/response chain

       Pragma            = "Pragma" ":" 1#pragma-directive
       pragma-directive  = "no-cache" | extension-pragma
       extension-pragma  = token [ "=" ( token | quoted-string ) ]

Proxy-Authenticate
The Proxy-Authenticate response-header field MUST be included as part of a 407 (Proxy Authentication Required) response

       Proxy-Authenticate  = "Proxy-Authenticate" ":" 1#challenge

Proxy-Authorization
The Proxy-Authorization request-header field allows the client to identify itself (or its user) to a proxy which requires authentication

       Proxy-Authorization     = "Proxy-Authorization" ":" credentials

Range
HTTP retrieval requests using conditional or unconditional GET methods MAY request one or more sub-ranges of the entity, instead of the entire entity, using the Range request header, which applies to the entity returned as the result of the reques

       Range = "Range" ":" ranges-specifier
       ranges-specifier = byte-ranges-specifier
       byte-ranges-specifier = bytes-unit "=" byte-range-set
       byte-range-set  = 1#( byte-range-spec | suffix-byte-range-spec )
       byte-range-spec = first-byte-pos "-" [last-byte-pos]
       first-byte-pos  = 1*DIGIT
       last-byte-pos   = 1*DIGIT
       suffix-byte-range-spec = "-" suffix-length
       suffix-length = 1*DIGIT

Referer
The Referer[sic] request-header field allows the client to specify, for the server's benefit, the address (URI) of the resource from which the Request-URI was obtained

       Referer        = "Referer" ":" ( absoluteURI | relativeURI )

Retry-After
The Retry-After response-header field can be used with a 503 (Service Unavailable) response to indicate how long the service is expected to be unavailable to the requesting client

       Retry-After  = "Retry-After" ":" ( HTTP-date | delta-seconds )

Server
The Server response-header field contains information about the software used by the origin server to handle the request

       Server         = "Server" ":" 1*( product | comment )

TE
The TE request-header field indicates what extension transfer-codings it is willing to accept in the response and whether or not it is willing to accept trailer fields in a chunked transfer-coding

       TE        = "TE" ":" #( t-codings )
       t-codings = "trailers" | ( transfer-extension [ accept-params ] )

Trailer
The Trailer general field value indicates that the given set of header fields is present in the trailer of a message encoded with chunked transfer-coding

       Trailer  = "Trailer" ":" 1#field-name

Transfer-Encoding
The Transfer-Encoding general-header field indicates what (if any) type of transformation has been applied to the message body in order to safely transfer it between the sender and the recipient

     Transfer-Encoding       = "Transfer-Encoding" ":" 1#transfer-coding

Upgrade
The Upgrade general-header allows the client to specify what additional communication protocols it supports and would like to use if the server finds it appropriate to switch protocols

       Upgrade        = "Upgrade" ":" 1#product

User-Agent
The User-Agent request-header field contains information about the user agent originating the request

       User-Agent     = "User-Agent" ":" 1*( product | comment )

Vary
The Vary field value indicates the set of request-header fields that fully determines, while the response is fresh, whether a cache is permitted to use the response to reply to a subsequent request without revalidation

       Vary  = "Vary" ":" ( "*" | 1#field-name )

Via
The Via general-header field MUST be used by gateways and proxies to indicate the intermediate protocols and recipients between the user agent and the server on requests, and between the origin server and the client on responses

      Via =  "Via" ":" 1#( received-protocol received-by [ comment ] )
      received-protocol = [ protocol-name "/" ] protocol-version
      protocol-name     = token
      protocol-version  = token
      received-by       = ( host [ ":" port ] ) | pseudonym
      pseudonym         = token

Warning
The Warning general-header field is used to carry additional information about the status or transformation of a message which might not be reflected in the message

       Warning    = "Warning" ":" 1#warning-value

       warning-value = warn-code SP warn-agent SP warn-text
                                             [SP warn-date]

       warn-code  = 3DIGIT
       warn-agent = ( host [ ":" port ] ) | pseudonym
                       ; the name or pseudonym of the server adding
                       ; the Warning header, for use in debugging
       warn-text  = quoted-string
       warn-date  = <"> HTTP-date <">

WWW-Authenticate
The WWW-Authenticate response-header field MUST be included in 401 (Unauthorized) response messages

       WWW-Authenticate  = "WWW-Authenticate" ":" 1#challenge

太多了,足足47个header filed,细节以后遇到再来看吧
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics