Rfc2616 HTTP/1.1 flag conversion and general syntax

Source: Internet
Author: User
Tags bit set repetition

Name = Definition
The name of a rule is simply the name itself (without any
Enclosing "<" and ">") and is separated from its definition by
Equal "=" character. white space is only significant in that
Indentation of continuation lines is used to indicate a rule
Definition that spans more than one line. certain basic rules are
In uppercase, such as SP, LWS, HT, CRLF, digit, Alpha, etc. Angle
Brackets are used within definitions whenever their presence will
Facilitate discerning the use of Rule names.

"Literal"
Quotation marks surround literal text. Unless stated otherwise,
The text is case-insensitive.

Rule1 | rule2
Elements separated by a bar ("|") are alternatives, e.g., "Yes |
No "will accept yes or no.

(Rule1 rule2)
Elements enclosed in parentheses are treated as a single element.
Thus, "(ELEM (FOO | bar) ELEM)" allows the token sequences "ELEM
Foo ELEM "and" ELEM bar ELEM ".

* Rule
The character "*" preceding an element indicates repetition.
Full Form is "<n> * <m> element" indicating at least <n> and at most
<M> occurrences of element. default values are 0 and infinity so
That "* (element)" allows any number, including zero; "1 * element"
Requires at least one; and "1*2 element" allows one or two.

[Rule]
Square brackets enclose optional elements; "[Foo bar]" is
Equivalent to "* 1 (FOO bar )".

N rule
Specific repetition: "<n> (element)" is equivalent
"<N> * <n> (element)"; that is, exactly <n> occurrences of (element ).
Thus 2 digit is a 2-digit number, and 3 Alpha is a string of three
Alphabetic characters.

# Rule
A construct "#" is defined, similar to "*", for defining lists
Elements. The full form is "<n ># <m> element" indicating at least
<N> and at most <m> elements, each separated by one or more commas
(",") And optional linear white space (LWS). This makes the usual
Form of lists very easy; a rule such
(* LWS element * (* LWS "," * LWS element ))
Can be shown
1 # Element
Wherever this construct is used, null elements are allowed, but do
Not contribute to the Count of elements present. That is,
"(Element), (element)" is permitted, but counts as only two
Elements. Therefore, where at least one element is required,
Least One non-null element must be present. default values are 0
And infinity so that "# element" allows any number, including zero;
"1 # element" requires at least one; and "1 #2 element" allows one or
Two.

; Comment
A semi-colon, set off some distance to the right of Rule text,
Starts a comment that continues to the end of line. This is
Simple Way of including useful notes in parallel with
Specifications.

Implied * LWS
The grammar described by this specification is word-based. Duplicate t
Where noted otherwise, linear white space (LWS) can be pinned DED
Between any two adjacent words (token or quoted-string), and
Between adjacent words and separators, without changing
Interpretation of a field. At least one delimiter (LWS and/or

Separators) must exist between any two tokens (for the definition
Of "token" below), since they wowould otherwise be interpreted as
Single token.

Octet = <Any 8-bit sequence of data>
Char = <Any US-ASCII character (octets 0-127)>
Upalpha = <Any US-ASCII uppercase letter "A" .. "Z">
Loalpha = <Any US-ASCII lowercase letter "A" .. "Z">
Alpha = upalpha | loalpha
Digit = <Any US-ASCII digit "0" .. "9">
CTL = <Any US-ASCII Control Character
(Octets 0-31) and del (127)>
Cr = <US-ASCII Cr, carriage return (13)>
LF = <US-ASCII lf, linefeed (10)>
SP = <US-ASCII sp, space (32)>
Ht = <US-ASCII HT, horizontal-tab (9)>
<"> = <US-ASCII double-quote Mark (34)>

CRLF = CR LF

LWS = [CRLF] 1 * (SP | HT)

TEXT = <Any octet except T CTLs, but including LWS>

Hex = "A" | "B" | "C" | "D" | "E" | "F" | "A" | "B" | "C" | "d "|" E "|" F "| digit

Token = 1 * <Any char character t CTLs or separators>
Separators = "(" | ")" | "<" | ">" | "@"
| "," | ";" | ":" | "\" | <">
| "/" | "[" | "]" | "? "|" ="
| "{" | "}" | SP | HT

Comment = "(" * (ctext | quoted-pair | comment )")"
Ctext = <any text excluding "(" and ")">

Quoted-string = (<"> * (qdtext | quoted-Pair) <">)
Qdtext = <any text before t <">

Quoted-pair = "\" char

WSP basic header Syntax:
Text-string = [quote] * Text end-of-string
; If the first character in the text is in the range of 128-255, a quote character must precede it.
; Otherwise the quote character must be omitted. The quote is not part of the contents.

Token-TEXT = token end-of-string

Quoted-string = <octet 34> * Text end-of-string
; The text encodes an rfc2616 quoted-string with the enclosing quotation-marks <"> removed

Extension-media = * Text end-of-string
; This encoding is used for media values, which have no well-known binary encoding

Short-integer = octet
; Integers in range 0-127 shall be encoded as a one octet value with the most significant bit set
; To one (1xxx XXXX) and with the value in the remaining least significant bits.

Long-integer = short-length multi-octet-integer
; The short-Length indicates the length of the Multi-octet-integer

Multi-octet-integer = 1*30 octet
; The content octets shall be an unsigned integer value
; With the most significant octet encoded first (big-endian representation ).
; The minimum number of octets must be used to encode the value.

Uintvar-integer = 1*5 octet
; The encoding is the same as the one defined for uintvar in Section 8.1.2.

Constrained-encoding = extension-media | short-integer
; This encoding is used for token values, which have no well-known binary encoding, or when
; The assigned number of the well-known encoding is small enough to fit into short-integer.

Quote = <octet 127>

End-of-string = <octet 0>

Value-length = short-length | (length-quote length)
; Value length is used to indicate the length of the value to follow
Short-length = <Any octet 0-30>
Length-quote = <octet 31>
Length = uintvar-integer

No-value = <octet 0>
; Used to indicate that the parameter actually has no value,
; Eg, as the parameter "bar" in "; Foo = xxx; bar; Baz = xy.pdf ".

Text-value = No-value | token-text | quoted-string

Integer-value = short-integer | long-integer

Date-value = long-integer
; The encoding of dates shall be done in number of seconds from
;, 00:00:00 GMT.

Delta-seconds-value = integer-Value

Q-value = 1*2 octet
; The encoding is the same as in uintvar-integer, but with restricted size. When quality factor 0
; And quality factors with one or two decimal digits are encoded and they shall be multiplied by 100
; And incremented by one, so that they encode as a one-octet value in range 1-100,
; IE, 0.1 is encoded as 11 (0x0b) and 0.99 encoded as 100 (0x64). Three decimal Quality
; Factors shall be multiplied with 1000 and incremented by 100, and the result shall be encoded
; As a one-octet or two-octet uintvar, eg, 0.333 shall be encoded as 0x83 0x31.
; Quality Factor 1 is the default value and shall never be sent.

Version-value = short-integer | text-string
; The three most significant bits of the Short-integer value are interpreted to encode a major
; Version number in the range 1-7, and the four least significant bits contain a minor version
; Number in the range 0-14. If there is only a major version number, this is encoded
; Placing the value 15 in the four least significant bits. if the version to be encoded fits these
; Constraints, a short-integer must be used, otherwise a text-string shall be used.

Uri-value = text-string
; Uri value shoshould be encoded per [rfc2616], but service user may use a different format.

Parameter = typed-parameter | untyped-Parameter

Typed-parameter = well-known-parameter-Token typed-Value
; The actual expected type of the value is implied by the well-known parameter

Well-known-parameter-Token = integer-Value
; The code values used for parameters are specified in the assigned numbers Appendix

Typed-value = compact-value | text-Value
; In addition to the expected type, there may be no value.
; If the value cannot be encoded using the expected type, it shall be encoded as text.

Compact-value = integer-value |
Date-value | Delta-seconds-value | Q-value | version-value |
Uri-Value

Untyped-parameter = token-text untyped-Value
; The type of the value is unknown, but it shall be encoded as an integer, if that is possible.

Untyped-value = integer-value | text-Value

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.