added http_accept feature to represent "Accept:" HTTP header

This commit is contained in:
Jocelyn Fiat
2011-07-29 15:13:34 +02:00
parent 801caa4e69
commit bbcc9ef44b

View File

@@ -4,85 +4,66 @@ note
Interface for a request environment Interface for a request environment
It includes CGI interface and a few extra values that are usually valuable It includes CGI interface and a few extra values that are usually valuable
See http://ken.coar.org/cgi/draft-coar-cgi-v11-03.txt See http://www.ietf.org/rfc/rfc3875
2.2. Basic Rules 2.2. Basic Rules
The following rules are used throughout this specification to The following rules are used throughout this specification to
describe basic parsing constructs. describe basic parsing constructs.
alpha = lowalpha | hialpha alpha = lowalpha | hialpha
alphanum = alpha | digit lowalpha = a | b | c | d | e | f | g | h |
lowalpha = a | b | c | d | e | f | g | h i | j | k | l | m | n | o | p |
| i | j | k | l | m | n | o | p q | r | s | t | u | v | w | x |
| q | r | s | t | u | v | w | x y | z
| y | z hialpha = A | B | C | D | E | F | G | H |
hialpha = A | B | C | D | E | F | G | H I | J | K | L | M | N | O | P |
| I | J | K | L | M | N | O | P Q | R | S | T | U | V | W | X |
| Q | R | S | T | U | V | W | X Y | Z
| Y | Z digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 8 | 9
| 8 | 9 alphanum = alpha | digit
hex = digit | A | B | C | D | E | F | a OCTET = <any 8-bit byte>
| b | c | d | e | f CHAR = alpha | digit | separator | ! | # | $ |
escaped = % hex hex %% | & | ' | * | + | - | . | ` |
OCTET = <any 8-bit sequence of data> ^ | _ | { | | | } | ~ | CTL
CHAR = <any US-ASCII character (octets 0 - 127)> CTL = <any control character>
CTL = <any US-ASCII control character SP = <space character>
(octets 0 - 31) and DEL (127)> HT = <horizontal tab character>
CR = <US-ASCII CR, carriage return (13)> NL = <newline>
LF = <US-ASCII LF, linefeed (10)> LWSP = SP | HT | NL
SP = <US-ASCII SP, space (32)> separator = ( | ) | < | > | @ | , | ; | : |
HT = <US-ASCII HT, horizontal tab (9)> \ | " | / | [ | ] | ? | = | { |
NL = CR | LF } | SP | HT
LWSP = SP | HT | NL token = 1*<any CHAR except CTLs or separators>
tspecial = ( | ) | "@" | , | ; | : | \ | " quoted-string = " *qdtext "
| / | [ | ] | ? | < | > | { | } qdtext = <any CHAR except " and CTLs but including LWSP>
| SP | HT | NL TEXT = <any printable character>
token = 1*<any CHAR except CTLs or tspecials>
quoted-string = ( " *qdtext " ) | ( "<" *qatext ">") 2.3. URL Encoding
qdtext = <any CHAR except %" and CTLs but including LWSP>
qatext = <any CHAR except "<", ">" and CTLs but including LWSP> reserved = ; | / | ? | : | @ | & | = | + | $ |
mark = - | _ | . | ! | ~ | * | ' | ( | ) , | [ | ]
unreserved = alphanum | mark
reserved = ; | / | ? | : | @ | & | = | $ | , hex = digit | A | B | C | D | E | F | a | b
uric = reserved | unreserved | escaped | c | d | e | f
escaped = "%%" hex hex
unreserved = alpha | digit | mark
mark = - | _ | . | ! | ~ | * | ' | ( | )
Note that newline (NL) need not be a single character, but can Note that newline (NL) need not be a single character, but can
be a character sequence. be a character sequence.
3.2. The Script-URI 3.2. The Script-URI
The 'Script-URI' is defined as the URI of the resource script-URI = <scheme> "://" <server-name> ":" <server-port>
identified by the metavariables. Often, this URI will be the <script-path> <extra-path> "?" <query-string>
same as the URI requested by the client (the 'Client-URI');
however, it need not be. Instead, it could be a URI invented
by the server, and so it can only be used in the context of
the server and its CGI interface.
The Script-URI has the syntax of generic-RL as defined in
section 2.1 of RFC 1808 [7], with the exception that object
parameters and fragment identifiers are not permitted:
<scheme>://<host><port>/<path>?<query>
The various components of the Script-URI are defined by some where <scheme> is found from SERVER_PROTOCOL, <server-name>,
of the metavariables (see section 4 below); <server-port> and <query-string> are the values of the respective
meta-variables. The SCRIPT_NAME and PATH_INFO values, URL-encoded
script-uri = protocol "://" SERVER_NAME ":" SERVER_PORT enc-script with ";", "=" and "?" reserved, give <script-path> and <extra-path>.
enc-path-info "?" QUERY_STRING
where 'protocol' is obtained from SERVER_PROTOCOL,
'enc-script' is a URL-encoded version of SCRIPT_NAME and
'enc-path-info' is a URL-encoded version of PATH_INFO. See
section 4.6 for more information about the PATH_INFO
metavariable.
Note that the scheme and the protocol are not identical; for
instance, a resource accessed via an SSL mechanism may have a
Client-URI with a scheme of "https" rather than "http".
CGI/1.1 provides no means for the script to reconstruct this,
and therefore the Script-URI includes the base protocol used.
]" ]"
legal: "See notice at end of class." legal: "See notice at end of class."
status: "See notice at end of class." status: "See notice at end of class."
@@ -518,6 +499,12 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
feature -- HTTP_* feature -- HTTP_*
http_accept: detachable STRING
-- Contents of the Accept: header from the current request, if there is one.
-- Example: 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
deferred
end
http_accept_charset: detachable STRING http_accept_charset: detachable STRING
-- Contents of the Accept-Charset: header from the current request, if there is one. -- Contents of the Accept-Charset: header from the current request, if there is one.
-- Example: 'iso-8859-1,*,utf-8'. -- Example: 'iso-8859-1,*,utf-8'.