naming: meta_variable(s)

changed some string type to READABLE_STRING_32
or READABLE_STRING_8 for now regarding Meta variables (need decision here..)
This commit is contained in:
Jocelyn Fiat
2011-08-29 12:48:03 +02:00
parent c20600f281
commit ed8f5d694f
7 changed files with 115 additions and 114 deletions

View File

@@ -114,7 +114,7 @@ feature -- Context helper
end end
end end
content_type_to_request_format (a_content_type: detachable STRING): detachable STRING content_type_to_request_format (a_content_type: detachable READABLE_STRING_8): detachable STRING
-- `a_content_type' converted into a request format name -- `a_content_type' converted into a request format name
do do
if a_content_type /= Void then if a_content_type /= Void then

View File

@@ -163,7 +163,7 @@ feature -- Match
exp: URI_TEMPLATE_EXPRESSION exp: URI_TEMPLATE_EXPRESSION
vn, s,t: STRING vn, s,t: STRING
vv: STRING vv: STRING
l_vars, l_path_vars, l_query_vars: HASH_TABLE [STRING, STRING] l_vars, l_path_vars, l_query_vars: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_GENERAL]
l_uri_count: INTEGER l_uri_count: INTEGER
tpl_count: INTEGER tpl_count: INTEGER
l_next_literal_separator: detachable STRING l_next_literal_separator: detachable STRING
@@ -358,7 +358,7 @@ feature {NONE} -- Implementation
end end
end end
import_path_style_parameters_into (a_content: STRING; res: HASH_TABLE [STRING, STRING]) import_path_style_parameters_into (a_content: STRING; res: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_GENERAL])
require require
a_content_attached: a_content /= Void a_content_attached: a_content /= Void
res_attached: res /= Void res_attached: res /= Void
@@ -366,7 +366,7 @@ feature {NONE} -- Implementation
import_custom_style_parameters_into (a_content, ';', res) import_custom_style_parameters_into (a_content, ';', res)
end end
import_form_style_parameters_into (a_content: STRING; res: HASH_TABLE [STRING, STRING]) import_form_style_parameters_into (a_content: STRING; res: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_GENERAL])
require require
a_content_attached: a_content /= Void a_content_attached: a_content /= Void
res_attached: res /= Void res_attached: res /= Void
@@ -374,7 +374,7 @@ feature {NONE} -- Implementation
import_custom_style_parameters_into (a_content, '&', res) import_custom_style_parameters_into (a_content, '&', res)
end end
import_custom_style_parameters_into (a_content: STRING; a_separator: CHARACTER; res: HASH_TABLE [STRING, STRING]) import_custom_style_parameters_into (a_content: STRING; a_separator: CHARACTER; res: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_GENERAL])
require require
a_content_attached: a_content /= Void a_content_attached: a_content /= Void
res_attached: res /= Void res_attached: res /= Void

View File

@@ -27,27 +27,27 @@ feature {NONE} -- Initialization
feature -- Access feature -- Access
path_variables: HASH_TABLE [STRING, READABLE_STRING_GENERAL] path_variables: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_GENERAL]
-- Variables being part of the path segments -- Variables being part of the path segments
query_variables: HASH_TABLE [STRING, READABLE_STRING_GENERAL] query_variables: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_GENERAL]
-- Variables being part of the query segments (i.e: after the ?) -- Variables being part of the query segments (i.e: after the ?)
feature -- Query feature -- Query
path_variable (n: READABLE_STRING_GENERAL): detachable STRING path_variable (n: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
-- Value related to query variable name `n' -- Value related to query variable name `n'
do do
Result := path_variables.item (n) Result := path_variables.item (n)
end end
query_variable (n: READABLE_STRING_GENERAL): detachable STRING query_variable (n: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
-- Value related to path variable name `n' -- Value related to path variable name `n'
do do
Result := query_variables.item (n) Result := query_variables.item (n)
end end
variable (n: READABLE_STRING_GENERAL): detachable STRING variable (n: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
-- Value related to variable name `n' -- Value related to variable name `n'
do do
Result := query_variable (n) Result := query_variable (n)

View File

@@ -89,14 +89,14 @@ feature -- Access: extra values
feature -- Access: CGI environment variables feature -- Access: CGI environment variables
meta_parameter (a_name: READABLE_STRING_GENERAL): detachable STRING meta_variable (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_8
-- Environment variable related to `a_name' -- Environment variable related to `a_name'
require require
a_name_valid: a_name /= Void and then not a_name.is_empty a_name_valid: a_name /= Void and then not a_name.is_empty
deferred deferred
end end
meta_parameters: HASH_TABLE [STRING, READABLE_STRING_GENERAL] meta_variables: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_GENERAL]
-- These variables are specific to requests made with HTTP. -- These variables are specific to requests made with HTTP.
-- Interpretation of these variables may depend on the value of -- Interpretation of these variables may depend on the value of
-- SERVER_PROTOCOL. -- SERVER_PROTOCOL.
@@ -128,7 +128,7 @@ feature -- Access: CGI environment variables
feature -- Common Gateway Interface - 1.1 8 January 1996 feature -- Common Gateway Interface - 1.1 8 January 1996
auth_type: detachable STRING auth_type: detachable READABLE_STRING_8
-- This variable is specific to requests made via the "http" -- This variable is specific to requests made via the "http"
-- scheme. -- scheme.
-- --
@@ -150,7 +150,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
deferred deferred
end end
content_length: detachable STRING content_length: detachable READABLE_STRING_8
-- This metavariable is set to the size of the message-body -- This metavariable is set to the size of the message-body
-- entity attached to the request, if any, in decimal number of -- entity attached to the request, if any, in decimal number of
-- octets. If no data are attached, then this metavariable is -- octets. If no data are attached, then this metavariable is
@@ -165,12 +165,12 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
deferred deferred
end end
content_length_value: INTEGER content_length_value: NATURAL_64
-- Integer value related to `content_length" -- Integer value related to `content_length"
deferred deferred
end end
content_type: detachable STRING content_type: detachable READABLE_STRING_8
-- If the request includes a message-body, CONTENT_TYPE is set to -- If the request includes a message-body, CONTENT_TYPE is set to
-- the Internet Media Type [9] of the attached entity if the type -- the Internet Media Type [9] of the attached entity if the type
-- was provided via a "Content-type" field in the request header, -- was provided via a "Content-type" field in the request header,
@@ -213,7 +213,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
deferred deferred
end end
gateway_interface: STRING gateway_interface: READABLE_STRING_8
-- This metavariable is set to the dialect of CGI being used by -- This metavariable is set to the dialect of CGI being used by
-- the server to communicate with the script. Syntax: -- the server to communicate with the script. Syntax:
-- --
@@ -246,7 +246,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
deferred deferred
end end
path_info: STRING path_info: READABLE_STRING_8
-- The PATH_INFO metavariable specifies a path to be interpreted -- The PATH_INFO metavariable specifies a path to be interpreted
-- by the CGI script. It identifies the resource or sub-resource -- by the CGI script. It identifies the resource or sub-resource
-- to be returned by the CGI script, and it is derived from the -- to be returned by the CGI script, and it is derived from the
@@ -277,7 +277,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
deferred deferred
end end
path_translated: detachable STRING path_translated: detachable READABLE_STRING_8
-- PATH_TRANSLATED is derived by taking any path-info component -- PATH_TRANSLATED is derived by taking any path-info component
-- of the request URI (see section 6.1.6), decoding it (see -- of the request URI (see section 6.1.6), decoding it (see
-- section 3.1), parsing it as a URI in its own right, and -- section 3.1), parsing it as a URI in its own right, and
@@ -323,7 +323,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
deferred deferred
end end
query_string: STRING query_string: READABLE_STRING_8
-- A URL-encoded string; the <query> part of the Script-URI. (See -- A URL-encoded string; the <query> part of the Script-URI. (See
-- section 3.2.) -- section 3.2.)
-- --
@@ -340,7 +340,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
deferred deferred
end end
remote_addr: STRING remote_addr: READABLE_STRING_8
-- The IP address of the client sending the request to the -- The IP address of the client sending the request to the
-- server. This is not necessarily that of the user agent (such -- server. This is not necessarily that of the user agent (such
-- as if the request came through a proxy). -- as if the request came through a proxy).
@@ -355,7 +355,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
deferred deferred
end end
remote_host: detachable STRING remote_host: detachable READABLE_STRING_8
-- The fully qualified domain name of the client sending the -- The fully qualified domain name of the client sending the
-- request to the server, if available, otherwise NULL. (See -- request to the server, if available, otherwise NULL. (See
-- section 6.1.9.) Fully qualified domain names take the form as -- section 6.1.9.) Fully qualified domain names take the form as
@@ -366,7 +366,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
deferred deferred
end end
remote_ident: detachable STRING remote_ident: detachable READABLE_STRING_8
-- The identity information reported about the connection by a -- The identity information reported about the connection by a
-- RFC 1413 [11] request to the remote agent, if available. -- RFC 1413 [11] request to the remote agent, if available.
-- Servers MAY choose not to support this feature, or not to -- Servers MAY choose not to support this feature, or not to
@@ -382,7 +382,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
deferred deferred
end end
remote_user: detachable STRING remote_user: detachable READABLE_STRING_8
-- If the request required authentication using the "Basic" -- If the request required authentication using the "Basic"
-- mechanism (i.e., the AUTH_TYPE metavariable is set to -- mechanism (i.e., the AUTH_TYPE metavariable is set to
-- "Basic"), then the value of the REMOTE_USER metavariable is -- "Basic"), then the value of the REMOTE_USER metavariable is
@@ -398,7 +398,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
deferred deferred
end end
request_method: STRING request_method: READABLE_STRING_8
-- The REQUEST_METHOD metavariable is set to the method with -- The REQUEST_METHOD metavariable is set to the method with
-- which the request was made, as described in section 5.1.1 of -- which the request was made, as described in section 5.1.1 of
-- the HTTP/1.0 specification [3] and section 5.1.1 of the -- the HTTP/1.0 specification [3] and section 5.1.1 of the
@@ -419,7 +419,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
deferred deferred
end end
script_name: STRING script_name: READABLE_STRING_8
-- The SCRIPT_NAME metavariable is set to a URL path that could -- The SCRIPT_NAME metavariable is set to a URL path that could
-- identify the CGI script (rather than the script's output). The -- identify the CGI script (rather than the script's output). The
-- syntax and semantics are identical to a decoded HTTP URL -- syntax and semantics are identical to a decoded HTTP URL
@@ -437,7 +437,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
deferred deferred
end end
server_name: STRING server_name: READABLE_STRING_8
-- The SERVER_NAME metavariable is set to the name of the server, -- The SERVER_NAME metavariable is set to the name of the server,
-- as derived from the <host> part of the Script-URI (see section -- as derived from the <host> part of the Script-URI (see section
-- 3.2). -- 3.2).
@@ -463,7 +463,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
deferred deferred
end end
server_protocol: STRING server_protocol: READABLE_STRING_8
-- The SERVER_PROTOCOL metavariable is set to the name and -- The SERVER_PROTOCOL metavariable is set to the name and
-- revision of the information protocol with which the request -- revision of the information protocol with which the request
-- arrived. This is not necessarily the same as the protocol -- arrived. This is not necessarily the same as the protocol
@@ -491,7 +491,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
deferred deferred
end end
server_software: STRING server_software: READABLE_STRING_8
-- The SERVER_SOFTWARE metavariable is set to the name and -- The SERVER_SOFTWARE metavariable is set to the name and
-- version of the information server software answering the -- version of the information server software answering the
-- request (and running the gateway). -- request (and running the gateway).
@@ -506,42 +506,42 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
feature -- HTTP_* feature -- HTTP_*
http_accept: detachable STRING http_accept: detachable READABLE_STRING_8
-- Contents of the Accept: header from the current request, if there is one. -- 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' -- Example: 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
deferred deferred
end end
http_accept_charset: detachable STRING http_accept_charset: detachable READABLE_STRING_8
-- 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'.
deferred deferred
end end
http_accept_encoding: detachable STRING http_accept_encoding: detachable READABLE_STRING_8
-- Contents of the Accept-Encoding: header from the current request, if there is one. -- Contents of the Accept-Encoding: header from the current request, if there is one.
-- Example: 'gzip'. -- Example: 'gzip'.
deferred deferred
end end
http_accept_language: detachable STRING http_accept_language: detachable READABLE_STRING_8
-- Contents of the Accept-Language: header from the current request, if there is one. -- Contents of the Accept-Language: header from the current request, if there is one.
-- Example: 'en'. -- Example: 'en'.
deferred deferred
end end
http_connection: detachable STRING http_connection: detachable READABLE_STRING_8
-- Contents of the Connection: header from the current request, if there is one. -- Contents of the Connection: header from the current request, if there is one.
-- Example: 'Keep-Alive'. -- Example: 'Keep-Alive'.
deferred deferred
end end
http_host: detachable STRING http_host: detachable READABLE_STRING_8
-- Contents of the Host: header from the current request, if there is one. -- Contents of the Host: header from the current request, if there is one.
deferred deferred
end end
http_referer: detachable STRING http_referer: detachable READABLE_STRING_8
-- The address of the page (if any) which referred the user agent to the current page. -- The address of the page (if any) which referred the user agent to the current page.
-- This is set by the user agent. -- This is set by the user agent.
-- Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. -- Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature.
@@ -549,7 +549,7 @@ feature -- HTTP_*
deferred deferred
end end
http_user_agent: detachable STRING http_user_agent: detachable READABLE_STRING_8
-- Contents of the User-Agent: header from the current request, if there is one. -- Contents of the User-Agent: header from the current request, if there is one.
-- This is a string denoting the user agent being which is accessing the page. -- This is a string denoting the user agent being which is accessing the page.
-- A typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586). -- A typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586).
@@ -558,19 +558,19 @@ feature -- HTTP_*
deferred deferred
end end
http_authorization: detachable STRING http_authorization: detachable READABLE_STRING_8
-- Contents of the Authorization: header from the current request, if there is one. -- Contents of the Authorization: header from the current request, if there is one.
deferred deferred
end end
feature -- Extra CGI environment variables feature -- Extra CGI environment variables
request_uri: STRING request_uri: READABLE_STRING_8
-- The URI which was given in order to access this page; for instance, '/index.html'. -- The URI which was given in order to access this page; for instance, '/index.html'.
deferred deferred
end end
orig_path_info: detachable STRING orig_path_info: detachable READABLE_STRING_8
-- Original version of `path_info' before processed by Current environment -- Original version of `path_info' before processed by Current environment
deferred deferred
end end
@@ -689,10 +689,10 @@ invariant
query_string_attached: query_string /= Void query_string_attached: query_string /= Void
remote_addr_attached: remote_addr /= Void remote_addr_attached: remote_addr /= Void
same_orig_path_info: orig_path_info ~ meta_parameter ({EWSGI_META_NAMES}.orig_path_info) same_orig_path_info: orig_path_info ~ meta_variable ({EWSGI_META_NAMES}.orig_path_info)
same_path_info: path_info ~ meta_parameter ({EWSGI_META_NAMES}.path_info) same_path_info: path_info ~ meta_variable ({EWSGI_META_NAMES}.path_info)
path_info_identical: path_info ~ meta_parameter ({EWSGI_META_NAMES}.path_info) path_info_identical: path_info ~ meta_variable ({EWSGI_META_NAMES}.path_info)
note note
copyright: "2011-2011, Eiffel Software and others" copyright: "2011-2011, Eiffel Software and others"

View File

@@ -37,13 +37,13 @@ feature {NONE} -- Initialization
set_meta_parameters (a_vars: HASH_TABLE [STRING, STRING]) set_meta_parameters (a_vars: HASH_TABLE [STRING, STRING])
-- Fill with variable from `a_vars' -- Fill with variable from `a_vars'
local local
s: detachable STRING s: detachable READABLE_STRING_8
table: HASH_TABLE [STRING, STRING] table: HASH_TABLE [STRING, STRING]
do do
create empty_string.make_empty create empty_string.make_empty
create table.make (a_vars.count) create table.make (a_vars.count)
meta_parameters := table meta_variables := table
from from
a_vars.start a_vars.start
until until
@@ -60,7 +60,7 @@ feature {NONE} -- Initialization
request_method := meta_parameter_or_default ({EWSGI_META_NAMES}.request_method, empty_string, False) request_method := meta_parameter_or_default ({EWSGI_META_NAMES}.request_method, empty_string, False)
--| CONTENT_TYPE --| CONTENT_TYPE
s := meta_parameter ({EWSGI_META_NAMES}.content_type) s := meta_variable ({EWSGI_META_NAMES}.content_type)
if s /= Void and then not s.is_empty then if s /= Void and then not s.is_empty then
content_type := s content_type := s
else else
@@ -68,10 +68,10 @@ feature {NONE} -- Initialization
end end
--| CONTENT_LENGTH --| CONTENT_LENGTH
s := meta_parameter ({EWSGI_META_NAMES}.content_length) s := meta_variable ({EWSGI_META_NAMES}.content_length)
content_length := s content_length := s
if s /= Void and then s.is_integer then if s /= Void and then s.is_natural_64 then
content_length_value := s.to_integer content_length_value := s.to_natural_64
else else
--| content_length := 0 --| content_length := 0
end end
@@ -83,7 +83,7 @@ feature {NONE} -- Initialization
server_name := meta_parameter_or_default ({EWSGI_META_NAMES}.server_name, empty_string, False) server_name := meta_parameter_or_default ({EWSGI_META_NAMES}.server_name, empty_string, False)
--| SERVER_PORT --| SERVER_PORT
s := meta_parameter ({EWSGI_META_NAMES}.server_port) s := meta_variable ({EWSGI_META_NAMES}.server_port)
if s /= Void and then s.is_integer then if s /= Void and then s.is_integer then
server_port := s.to_integer server_port := s.to_integer
else else
@@ -119,7 +119,7 @@ feature {NONE} -- Initialization
set_meta_parameter (rq_uri, {EWSGI_META_NAMES}.self) set_meta_parameter (rq_uri, {EWSGI_META_NAMES}.self)
end end
end end
if meta_parameter ({EWSGI_META_NAMES}.request_time) = Void then if meta_variable ({EWSGI_META_NAMES}.request_time) = Void then
set_meta_parameter (date_time_utilities.unix_time_stamp (Void).out, {EWSGI_META_NAMES}.request_time) set_meta_parameter (date_time_utilities.unix_time_stamp (Void).out, {EWSGI_META_NAMES}.request_time)
end end
end end
@@ -160,7 +160,7 @@ feature -- Access extra information
-- Request time (UTC) -- Request time (UTC)
do do
if if
attached meta_parameter ({EWSGI_META_NAMES}.request_time) as t and then attached meta_variable ({EWSGI_META_NAMES}.request_time) as t and then
t.is_integer_64 t.is_integer_64
then then
Result := date_time_utilities.unix_time_stamp_to_date_time (t.to_integer_64) Result := date_time_utilities.unix_time_stamp_to_date_time (t.to_integer_64)
@@ -169,22 +169,22 @@ feature -- Access extra information
feature -- Access: CGI meta parameters feature -- Access: CGI meta parameters
meta_parameters: HASH_TABLE [STRING, READABLE_STRING_GENERAL] meta_variables: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_GENERAL]
-- CGI Environment parameters -- CGI Environment parameters
meta_parameter (a_name: READABLE_STRING_GENERAL): detachable STRING meta_variable (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_8
-- CGI meta variable related to `a_name' -- CGI meta variable related to `a_name'
do do
Result := meta_parameters.item (a_name) Result := meta_variables.item (a_name)
end end
meta_parameter_or_default (a_name: READABLE_STRING_GENERAL; a_default: STRING; use_default_when_empty: BOOLEAN): STRING meta_parameter_or_default (a_name: READABLE_STRING_GENERAL; a_default: READABLE_STRING_8; use_default_when_empty: BOOLEAN): READABLE_STRING_8
-- Value for meta parameter `a_name' -- Value for meta parameter `a_name'
-- If not found, return `a_default' -- If not found, return `a_default'
require require
a_name_not_empty: a_name /= Void and then not a_name.is_empty a_name_not_empty: a_name /= Void and then not a_name.is_empty
do do
if attached meta_parameter (a_name) as s then if attached meta_variable (a_name) as s then
if use_default_when_empty and then s.is_empty then if use_default_when_empty and then s.is_empty then
Result := a_default Result := a_default
else else
@@ -197,34 +197,34 @@ feature -- Access: CGI meta parameters
set_meta_parameter (a_name: READABLE_STRING_GENERAL; a_value: STRING) set_meta_parameter (a_name: READABLE_STRING_GENERAL; a_value: STRING)
do do
meta_parameters.force (a_value, a_name) meta_variables.force (a_value, a_name)
ensure ensure
param_set: meta_parameter (a_name) ~ a_value param_set: meta_variable (a_name) ~ a_value
end end
unset_meta_parameter (a_name: READABLE_STRING_GENERAL) unset_meta_parameter (a_name: READABLE_STRING_GENERAL)
do do
meta_parameters.remove (a_name) meta_variables.remove (a_name)
ensure ensure
param_unset: meta_parameter (a_name) = Void param_unset: meta_variable (a_name) = Void
end end
feature -- Access: CGI meta parameters - 1.1 feature -- Access: CGI meta parameters - 1.1
auth_type: detachable STRING auth_type: detachable READABLE_STRING_8
content_length: detachable STRING content_length: detachable READABLE_STRING_8
content_length_value: INTEGER content_length_value: NATURAL_64
content_type: detachable STRING content_type: detachable READABLE_STRING_8
gateway_interface: STRING gateway_interface: READABLE_STRING_8
do do
Result := meta_parameter_or_default ({EWSGI_META_NAMES}.gateway_interface, "", False) Result := meta_parameter_or_default ({EWSGI_META_NAMES}.gateway_interface, "", False)
end end
path_info: STRING path_info: READABLE_STRING_8
-- <Precursor/> -- <Precursor/>
-- --
--| For instance, if the current script was accessed via the URL --| For instance, if the current script was accessed via the URL
@@ -232,110 +232,110 @@ feature -- Access: CGI meta parameters - 1.1
--| --|
--| Note that is the PATH_INFO variable does not exists, the `path_info' value will be empty --| Note that is the PATH_INFO variable does not exists, the `path_info' value will be empty
path_translated: detachable STRING path_translated: detachable READABLE_STRING_8
do do
Result := meta_parameter ({EWSGI_META_NAMES}.path_translated) Result := meta_variable ({EWSGI_META_NAMES}.path_translated)
end end
query_string: STRING query_string: READABLE_STRING_8
remote_addr: STRING remote_addr: READABLE_STRING_8
remote_host: STRING remote_host: READABLE_STRING_8
remote_ident: detachable STRING remote_ident: detachable READABLE_STRING_8
do do
Result := meta_parameter ({EWSGI_META_NAMES}.remote_ident) Result := meta_variable ({EWSGI_META_NAMES}.remote_ident)
end end
remote_user: detachable STRING remote_user: detachable READABLE_STRING_8
do do
Result := meta_parameter ({EWSGI_META_NAMES}.remote_user) Result := meta_variable ({EWSGI_META_NAMES}.remote_user)
end end
request_method: STRING request_method: READABLE_STRING_8
script_name: STRING script_name: READABLE_STRING_8
server_name: STRING server_name: READABLE_STRING_8
server_port: INTEGER server_port: INTEGER
server_protocol: STRING server_protocol: READABLE_STRING_8
do do
Result := meta_parameter_or_default ({EWSGI_META_NAMES}.server_protocol, "HTTP/1.0", True) Result := meta_parameter_or_default ({EWSGI_META_NAMES}.server_protocol, "HTTP/1.0", True)
end end
server_software: STRING server_software: READABLE_STRING_8
do do
Result := meta_parameter_or_default ({EWSGI_META_NAMES}.server_software, "Unknown Server", True) Result := meta_parameter_or_default ({EWSGI_META_NAMES}.server_software, "Unknown Server", True)
end end
feature -- Access: HTTP_* CGI meta parameters - 1.1 feature -- Access: HTTP_* CGI meta parameters - 1.1
http_accept: detachable STRING http_accept: detachable READABLE_STRING_8
-- Contents of the Accept: header from the current request, if there is one. -- Contents of the Accept: header from the current request, if there is one.
do do
Result := meta_parameter ({EWSGI_META_NAMES}.http_accept) Result := meta_variable ({EWSGI_META_NAMES}.http_accept)
end end
http_accept_charset: detachable STRING http_accept_charset: detachable READABLE_STRING_8
-- 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'.
do do
Result := meta_parameter ({EWSGI_META_NAMES}.http_accept_charset) Result := meta_variable ({EWSGI_META_NAMES}.http_accept_charset)
end end
http_accept_encoding: detachable STRING http_accept_encoding: detachable READABLE_STRING_8
-- Contents of the Accept-Encoding: header from the current request, if there is one. -- Contents of the Accept-Encoding: header from the current request, if there is one.
-- Example: 'gzip'. -- Example: 'gzip'.
do do
Result := meta_parameter ({EWSGI_META_NAMES}.http_accept_encoding) Result := meta_variable ({EWSGI_META_NAMES}.http_accept_encoding)
end end
http_accept_language: detachable STRING http_accept_language: detachable READABLE_STRING_8
-- Contents of the Accept-Language: header from the current request, if there is one. -- Contents of the Accept-Language: header from the current request, if there is one.
-- Example: 'en'. -- Example: 'en'.
do do
Result := meta_parameter ({EWSGI_META_NAMES}.http_accept_language) Result := meta_variable ({EWSGI_META_NAMES}.http_accept_language)
end end
http_connection: detachable STRING http_connection: detachable READABLE_STRING_8
-- Contents of the Connection: header from the current request, if there is one. -- Contents of the Connection: header from the current request, if there is one.
-- Example: 'Keep-Alive'. -- Example: 'Keep-Alive'.
do do
Result := meta_parameter ({EWSGI_META_NAMES}.http_connection) Result := meta_variable ({EWSGI_META_NAMES}.http_connection)
end end
http_host: detachable STRING http_host: detachable READABLE_STRING_8
-- Contents of the Host: header from the current request, if there is one. -- Contents of the Host: header from the current request, if there is one.
do do
Result := meta_parameter ({EWSGI_META_NAMES}.http_host) Result := meta_variable ({EWSGI_META_NAMES}.http_host)
end end
http_referer: detachable STRING http_referer: detachable READABLE_STRING_8
-- The address of the page (if any) which referred the user agent to the current page. -- The address of the page (if any) which referred the user agent to the current page.
-- This is set by the user agent. -- This is set by the user agent.
-- Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. -- Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature.
-- In short, it cannot really be trusted. -- In short, it cannot really be trusted.
do do
Result := meta_parameter ({EWSGI_META_NAMES}.http_referer) Result := meta_variable ({EWSGI_META_NAMES}.http_referer)
end end
http_user_agent: detachable STRING http_user_agent: detachable READABLE_STRING_8
-- Contents of the User-Agent: header from the current request, if there is one. -- Contents of the User-Agent: header from the current request, if there is one.
-- This is a string denoting the user agent being which is accessing the page. -- This is a string denoting the user agent being which is accessing the page.
-- A typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586). -- A typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586).
-- Among other things, you can use this value to tailor your page's -- Among other things, you can use this value to tailor your page's
-- output to the capabilities of the user agent. -- output to the capabilities of the user agent.
do do
Result := meta_parameter ({EWSGI_META_NAMES}.http_user_agent) Result := meta_variable ({EWSGI_META_NAMES}.http_user_agent)
end end
http_authorization: detachable STRING http_authorization: detachable READABLE_STRING_8
-- Contents of the Authorization: header from the current request, if there is one. -- Contents of the Authorization: header from the current request, if there is one.
do do
Result := meta_parameter ({EWSGI_META_NAMES}.http_authorization) Result := meta_variable ({EWSGI_META_NAMES}.http_authorization)
end end
feature -- Access: Extension to CGI meta parameters - 1.1 feature -- Access: Extension to CGI meta parameters - 1.1
@@ -363,7 +363,7 @@ feature {NONE} -- Element change: CGI meta parameter related to PATH_INFO
orig_path_info := Void orig_path_info := Void
unset_meta_parameter ({EWSGI_META_NAMES}.orig_path_info) unset_meta_parameter ({EWSGI_META_NAMES}.orig_path_info)
ensure ensure
unset: attached meta_parameter ({EWSGI_META_NAMES}.orig_path_info) unset: attached meta_variable ({EWSGI_META_NAMES}.orig_path_info)
end end
update_path_info update_path_info
@@ -481,8 +481,8 @@ feature -- Form fields and related
local local
vars: like internal_form_data_parameters vars: like internal_form_data_parameters
s: STRING s: STRING
n: INTEGER n: NATURAL_64
l_type: detachable STRING l_type: like content_type
do do
vars := internal_form_data_parameters vars := internal_form_data_parameters
if vars = Void then if vars = Void then
@@ -495,10 +495,10 @@ feature -- Form fields and related
then then
create vars.make (5) create vars.make (5)
--| FIXME: optimization ... fetch the input data progressively, otherwise we might run out of memory ... --| FIXME: optimization ... fetch the input data progressively, otherwise we might run out of memory ...
s := form_input_data (n) s := form_input_data (n.to_integer_32) --| FIXME truncated from NAT64 to INT32
analyze_multipart_form (l_type, s, vars) analyze_multipart_form (l_type, s, vars)
else else
s := form_input_data (n) s := form_input_data (n.to_integer_32) --| FIXME truncated from NAT64 to INT32
vars := urlencoded_parameters (s, True) vars := urlencoded_parameters (s, True)
end end
if raw_post_data_recorded then if raw_post_data_recorded then
@@ -538,7 +538,7 @@ feature -- Cookies
do do
l_cookies := internal_cookies l_cookies := internal_cookies
if l_cookies = Void then if l_cookies = Void then
if attached meta_parameter ({EWSGI_META_NAMES}.http_cookie) as s then if attached meta_variable ({EWSGI_META_NAMES}.http_cookie) as s then
create l_cookies.make (5) create l_cookies.make (5)
from from
n := s.count n := s.count
@@ -589,7 +589,7 @@ feature -- Access: global variable
do do
create Result.make (100) create Result.make (100)
vars := meta_parameters vars := meta_variables
from from
vars.start vars.start
until until
@@ -637,7 +637,7 @@ feature -- Access: global variable
local local
s: detachable READABLE_STRING_GENERAL s: detachable READABLE_STRING_GENERAL
do do
s := meta_parameter (a_name) s := meta_variable (a_name)
if s = Void then if s = Void then
s := query_parameter (a_name) s := query_parameter (a_name)
if s = Void then if s = Void then
@@ -1115,7 +1115,7 @@ feature {NONE} -- Implementation
extract_variables extract_variables
-- Extract relevant meta parameters -- Extract relevant meta parameters
local local
s: detachable STRING s: detachable READABLE_STRING_8
do do
s := request_uri s := request_uri
if s.is_empty then if s.is_empty then

View File

@@ -23,9 +23,9 @@ feature -- Access
path: STRING path: STRING
-- ??? -- ???
request_content_type (content_type_supported: detachable ARRAY [STRING]): detachable STRING request_content_type (content_type_supported: detachable ARRAY [STRING]): detachable READABLE_STRING_8
local local
s: detachable STRING s: detachable READABLE_STRING_8
i,n: INTEGER i,n: INTEGER
do do
Result := request.content_type Result := request.content_type

View File

@@ -11,11 +11,12 @@ feature -- Access
accepted_content_types (req: EWSGI_REQUEST): detachable ARRAYED_LIST [STRING] accepted_content_types (req: EWSGI_REQUEST): detachable ARRAYED_LIST [STRING]
local local
l_accept: detachable STRING l_accept: detachable READABLE_STRING_8
s,q: STRING s: STRING_8
q: READABLE_STRING_8
p: INTEGER p: INTEGER
lst: LIST [STRING] lst: LIST [READABLE_STRING_8]
qs: QUICK_SORTER [STRING] qs: QUICK_SORTER [READABLE_STRING_8]
do do
l_accept := req.http_accept l_accept := req.http_accept
--TEST l_accept := "text/html,application/xhtml+xml;q=0.6,application/xml;q=0.2,text/plain;q=0.5,*/*;q=0.8" --TEST l_accept := "text/html,application/xhtml+xml;q=0.6,application/xml;q=0.2,text/plain;q=0.5,*/*;q=0.8"