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

HTTP1.1 Notes 2, Protocol Parameters

阅读更多
HTTP Version
       HTTP-Version   = "HTTP" "/" 1*DIGIT "." 1*DIGIT

Uniform Resource Identifiers
As far as HTTP is concerned, Uniform Resource Identifiers are simply formatted strings which identify--via name, location, or any other characteristic--a resource.

       http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query ]]

If the port is empty or not given, port 80 is assumed.

A server SHOULD return 414 (Request-URI Too Long) status if a URI is longer than the server can handle

If the abs_path is not present in the URL, it MUST be given as "/" when used as a Request-URI for a resource

URI Comparison:
  - A port that is empty or not given is equivalent to the default port for that URI-reference;
  - Comparisons of host names MUST be case-insensitive;
  - Comparisons of scheme names MUST be case-insensitive;
  - An empty abs_path is equivalent to an abs_path of "/".

Characters other than those in the "reserved" and "unsafe" sets (RFC 2396) are equivalent to their ""%" HEX HEX" encoding.

       escaped     = "%" hex hex
       hex         = digit | "A" | "B" | "C" | "D" | "E" | "F" |
                            "a" | "b" | "c" | "d" | "e" | "f"

Date/Time Formats
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

HTTP/1.1 clients and servers that parse the date value MUST accept all three formats (for compatibility with HTTP/1.0), though they MUST only generate the RFC 1123 format for representing HTTP-date values in header fields.

All HTTP date/time stamps MUST be represented in Greenwich Mean Time (GMT), without exception.

       HTTP-date    = rfc1123-date | rfc850-date | asctime-date
       rfc1123-date = wkday "," SP date1 SP time SP "GMT"
       rfc850-date  = weekday "," SP date2 SP time SP "GMT"
       asctime-date = wkday SP date3 SP time SP 4DIGIT
       date1        = 2DIGIT SP month SP 4DIGIT
                      ; day month year (e.g., 02 Jun 1982)
       date2        = 2DIGIT "-" month "-" 2DIGIT
                      ; day-month-year (e.g., 02-Jun-82)
       date3        = month SP ( 2DIGIT | ( SP 1DIGIT ))
                      ; month day (e.g., Jun  2)
       time         = 2DIGIT ":" 2DIGIT ":" 2DIGIT
                      ; 00:00:00 - 23:59:59
       wkday        = "Mon" | "Tue" | "Wed"
                    | "Thu" | "Fri" | "Sat" | "Sun"
       weekday      = "Monday" | "Tuesday" | "Wednesday"
                    | "Thursday" | "Friday" | "Saturday" | "Sunday"
       month        = "Jan" | "Feb" | "Mar" | "Apr"
                    | "May" | "Jun" | "Jul" | "Aug"
                    | "Sep" | "Oct" | "Nov" | "Dec"

       delta-seconds  = 1*DIGIT

Character Sets
       charset = token

HTTP character sets are identified by case-insensitive tokens
The complete set of tokens is defined by the IANA Character Set registry

Content Codings
       content-coding   = token

All content-coding values are case-insensitive
HTTP/1.1 uses content-coding values in the Accept-Encoding and Content-Encoding header fields.

The Internet Assigned Numbers Authority (IANA) acts as a registry for content-coding value tokens. Initially, the registry contains the following tokens:
gzip
compress
deflate
identity(default encoding, use no transformation)

Transfer Codings
       transfer-coding         = "chunked" | transfer-extension
       transfer-extension      = token *( ";" parameter )

Transfer-coding values are used to indicate an encoding transformation that has been, can be, or may need to be applied to an entity-body in order to ensure "safe transport" through the network.
This differs from a content coding in that the transfer-coding is a property of the message, not of the original entity.
All transfer-coding values are case-insensitive. HTTP/1.1 uses transfer-coding values in the TE header field and in the Transfer-Encoding header field

The Internet Assigned Numbers Authority (IANA) acts as a registry for transfer-coding value tokens. Initially, the registry contains the following tokens:
chunked
identity
gzip
compress
deflate

A server which receives an entity-body with a transfer-coding it does not understand SHOULD return 501 (Unimplemented), and close the connection.

Media Types
       media-type     = type "/" subtype *( ";" parameter )
       type           = token
       subtype        = token

The type, subtype, and parameter attribute names are case- insensitive.
Linear white space (LWS) MUST NOT be used between the type and subtype, nor between an attribute and its value.

Note: The "multipart/form-data" type has been specifically defined
      for carrying form data suitable for processing via the POST
      request method, as described in RFC 1867

Product Tokens
       product         = token ["/" product-version]
       product-version = token

Examples:

       User-Agent: CERN-LineMode/2.15 libwww/2.17b3
       Server: Apache/0.8.4

Quality Values
       qvalue         = ( "0" [ "." 0*3DIGIT ] )
                      | ( "1" [ "." 0*3("0") ] )

HTTP content negotiation uses short "floating point" numbers to indicate the relative importance ("weight") of various negotiable parameters.
A weight is normalized to a real number in the range 0 through 1, where 0 is the minimum and 1 the maximum value.
If a parameter has a quality value of 0, then content with this parameter is `not acceptable' for the client.

Language Tags
        language-tag  = primary-tag *( "-" subtag )
        primary-tag   = 1*8ALPHA
        subtag        = 1*8ALPHA
A language tag identifies a natural language spoken, written, or otherwise conveyed by human beings for communication of information to other human beings.
HTTP uses language tags within the Accept-Language and Content- Language fields.
Example:
en, en-US, en-cockney, i-cherokee, x-pig-latin

Entity Tags
      entity-tag = [ weak ] opaque-tag
      weak       = "W/"
      opaque-tag = quoted-string
Entity tags are used for comparing two or more entities from the same requested resource.
HTTP/1.1 uses entity tags in the ETag , If-Match , If-None-Match , and If-Range header fields.


Range Utils
      range-unit       = bytes-unit | other-range-unit
      bytes-unit       = "bytes"
      other-range-unit = token

HTTP/1.1 allows a client to request that only part (a range of) the response entity be included within the response.
HTTP/1.1 uses range units in the Range and Content-Range header fields.


上一个百度的例子:
D:\projects\maui>curl -I http://www.baidu.com
HTTP/1.1 200 OK
Date: Wed, 24 Dec 2008 05:13:25 GMT
Server: BWS/1.0
Content-Length: 4064
Content-Type: text/html
Cache-Control: private
Expires: Wed, 24 Dec 2008 05:13:25 GMT
Set-Cookie: BAIDUID=C836D6EC630FBFE49ABAD74F7F62D2E1:FG=1; expires=Wed, 24-Dec-3
8 05:13:25 GMT; path=/; domain=.baidu.com
P3P: CP=" OTI DSP COR IVA OUR IND COM "
分享到:
评论

相关推荐

    python3.6.5参考手册 chm

    PEP 314: Metadata for Python Software Packages v1.1 PEP 328: Absolute and Relative Imports PEP 338: Executing Modules as Scripts PEP 341: Unified try/except/finally PEP 342: New Generator Features...

    ZendFramework中文文档

    Notes Regarding Cascading Operations 11. Zend_Debug 11.1. 输出变量的值 (Dumping Variables) 12. Zend_Exception 12.1. 使用“异常” 13. Zend_Feed 13.1. 介绍 13.2. 导入Feeds 13.2.1. 定制 feeds ...

    java7帮助文档

    RowSet 1.1: The introduction of the RowSetFactory interface and the RowSetProvider class, which enable you to create all types of row sets supported by your JDBC driver; see Using the RowSetFactory ...

    Network Security: Private Communication in a Public World, Second Edition

    Section 1.1. Roadmap to the Book Section 1.2. What Type of Book Is This? Section 1.3. Terminology Section 1.4. Notation Section 1.5. Primer on Networking Section 1.6. Active vs. Passive ...

    CIS_Solaris_10_Benchmark_v5.0.0

    2. Restrict Services ....................................................................................................................................... 17 2.1 Establish a Secure Baseline ...........

Global site tag (gtag.js) - Google Analytics