本文为对RFC2616第三节的简单整理。详文请参考官网。
3.1 HTTP Version
HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT
3.2 Uniform Resource Identifiers
http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query ]]
3.3 Date/Time Formats
3.3.1 Full Date
HTTP-date = rfc1123-date | rfc850-date | asctime-date Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
3.3.2 Delta Seconds
delta-seconds = 1*DIGIT
3.4 Character Sets
charset = token
3.4.1 Missing Charset
3.5 Content Codings
content-coding = token
gzip "x-gzip"
compress "x-compress"
deflate
identity (used only in the Accept- Encoding header)
New
3.6 Transfer Codings
transfer-coding = "chunked" | transfer-extension
transfer-extension = token *( ";" parameter )
parameter = attribute "=" value
attribute = token
value = token | quoted-string
3.6.1 Chunked Transfer Coding
Chunked-Body = *chunk last-chunk trailer CRLF chunk = chunk-size [ chunk-extension ] CRLF chunk-data CRLF chunk-size = 1*HEX last-chunk = 1*("0") [ chunk-extension ] CRLF chunk-extension= *( ";" chunk-ext-name [ "=" chunk-ext-val ] ) chunk-ext-name = token chunk-ext-val = token | quoted-string chunk-data = chunk-size(OCTET) trailer = *(entity-header CRLF)
3.7 Media Types
media-type = type "/" subtype *( ";" parameter )
type = token
subtype = token
3.7.1 Canonicalization and Text Defaults
3.7.2 Multipart Types
3.8 Product Tokens
product = token ["/" product-version]
product-version = token
Examples:
User-Agent: CERN-LineMode/2.15 libwww/2.17b3
Server: Apache/0.8.4
3.9 Quality Values
qvalue = ( "0" [ "." 0*3DIGIT ] )
| ( "1" [ "." 0*3("0") ] )
3.10 Language Tags
language-tag = primary-tag *( "-" subtag )
primary-tag = 1*8ALPHA
subtag = 1*8ALPHA
Example tags include:
en, en-US, en-cockney, i-cherokee, x-pig-latin
3.11 Entity Tags
entity-tag = [ weak ] opaque-tag
weak = "W/"
opaque-tag = quoted-string
3.12 Range Units
range-unit = bytes-unit | other-range-unit bytes-unit = "bytes" other-range-unit = token