From bbcc9ef44b58cebd4bf816baa6b35e58a3508399 Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Fri, 29 Jul 2011 15:13:34 +0200 Subject: [PATCH] added http_accept feature to represent "Accept:" HTTP header --- .../specification/request/ewsgi_environment.e | 119 ++++++++---------- 1 file changed, 53 insertions(+), 66 deletions(-) diff --git a/library/server/ewsgi/specification/request/ewsgi_environment.e b/library/server/ewsgi/specification/request/ewsgi_environment.e index 34cd2b30..07f6d11a 100644 --- a/library/server/ewsgi/specification/request/ewsgi_environment.e +++ b/library/server/ewsgi/specification/request/ewsgi_environment.e @@ -4,85 +4,66 @@ note Interface for a request environment 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 The following rules are used throughout this specification to describe basic parsing constructs. - - alpha = lowalpha | hialpha - alphanum = alpha | digit - lowalpha = a | b | c | d | e | f | g | h - | i | j | k | l | m | n | o | p - | q | r | s | t | u | v | w | x - | y | z - hialpha = A | B | C | D | E | F | G | H - | I | J | K | L | M | N | O | P - | Q | R | S | T | U | V | W | X - | Y | Z - digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 - | 8 | 9 - hex = digit | A | B | C | D | E | F | a - | b | c | d | e | f - escaped = % hex hex - OCTET = - CHAR = - CTL = - CR = - LF = - SP = - HT = - NL = CR | LF - LWSP = SP | HT | NL - tspecial = ( | ) | "@" | , | ; | : | \ | " - | / | [ | ] | ? | < | > | { | } - | SP | HT | NL - token = 1* - quoted-string = ( " *qdtext " ) | ( "<" *qatext ">") - qdtext = - qatext = " and CTLs but including LWSP> - mark = - | _ | . | ! | ~ | * | ' | ( | ) - unreserved = alphanum | mark - reserved = ; | / | ? | : | @ | & | = | $ | , - uric = reserved | unreserved | escaped + + alpha = lowalpha | hialpha + lowalpha = a | b | c | d | e | f | g | h | + i | j | k | l | m | n | o | p | + q | r | s | t | u | v | w | x | + y | z + hialpha = A | B | C | D | E | F | G | H | + I | J | K | L | M | N | O | P | + Q | R | S | T | U | V | W | X | + Y | Z + digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | + 8 | 9 + alphanum = alpha | digit + OCTET = + CHAR = alpha | digit | separator | ! | # | $ | + %% | & | ' | * | + | - | . | ` | + ^ | _ | { | | | } | ~ | CTL + CTL = + SP = + HT = + NL = + LWSP = SP | HT | NL + separator = ( | ) | < | > | @ | , | ; | : | + \ | " | / | [ | ] | ? | = | { | + } | SP | HT + token = 1* + quoted-string = " *qdtext " + qdtext = + TEXT = + + 2.3. URL Encoding + + reserved = ; | / | ? | : | @ | & | = | + | $ | + , | [ | ] + + hex = digit | A | B | C | D | E | F | a | b + | c | d | e | f + escaped = "%%" hex hex + unreserved = alpha | digit | mark + mark = - | _ | . | ! | ~ | * | ' | ( | ) Note that newline (NL) need not be a single character, but can be a character sequence. 3.2. The Script-URI - The 'Script-URI' is defined as the URI of the resource - identified by the metavariables. Often, this URI will be the - 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: - - :///? + script-URI = "://" ":" + "?" - The various components of the Script-URI are defined by some - of the metavariables (see section 4 below); - - script-uri = protocol "://" SERVER_NAME ":" SERVER_PORT enc-script - enc-path-info "?" QUERY_STRING + where is found from SERVER_PROTOCOL, , + and are the values of the respective + meta-variables. The SCRIPT_NAME and PATH_INFO values, URL-encoded + with ";", "=" and "?" reserved, give and . - 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." status: "See notice at end of class." @@ -518,6 +499,12 @@ feature -- Common Gateway Interface - 1.1 8 January 1996 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 -- Contents of the Accept-Charset: header from the current request, if there is one. -- Example: 'iso-8859-1,*,utf-8'.