Changed prefix from EWSGI_ to WGI_
Changed meta variable type to READABLE_STRING_32
This commit is contained in:
@@ -8,7 +8,7 @@ class
|
||||
EWF_CGI_CONNECTOR
|
||||
|
||||
inherit
|
||||
EWSGI_CONNECTOR
|
||||
WGI_CONNECTOR
|
||||
|
||||
create
|
||||
make
|
||||
@@ -17,8 +17,8 @@ feature -- Execution
|
||||
|
||||
launch
|
||||
local
|
||||
req: EWSGI_REQUEST_FROM_TABLE
|
||||
res: EWSGI_RESPONSE_STREAM_BUFFER
|
||||
req: WGI_REQUEST_FROM_TABLE
|
||||
res: WGI_RESPONSE_STREAM_BUFFER
|
||||
do
|
||||
create req.make ((create {EXECUTION_ENVIRONMENT}).starting_environment_variables, create {EWF_CGI_INPUT_STREAM}.make)
|
||||
create res.make (create {EWF_CGI_OUTPUT_STREAM}.make)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
note
|
||||
description: "Summary description for GW_CGI_INPUT_STREAM."
|
||||
description: "Summary description for EWF_CGI_INPUT_STREAM."
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
@@ -9,7 +9,7 @@ class
|
||||
EWF_CGI_INPUT_STREAM
|
||||
|
||||
inherit
|
||||
EWSGI_INPUT_STREAM
|
||||
WGI_INPUT_STREAM
|
||||
|
||||
CONSOLE
|
||||
rename
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
note
|
||||
description: "Summary description for GW_CGI_OUTPUT_STREAM."
|
||||
description: "Summary description for EWF_CGI_OUTPUT_STREAM."
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
@@ -9,7 +9,7 @@ class
|
||||
EWF_CGI_OUTPUT_STREAM
|
||||
|
||||
inherit
|
||||
EWSGI_OUTPUT_STREAM
|
||||
WGI_OUTPUT_STREAM
|
||||
undefine
|
||||
flush
|
||||
end
|
||||
|
||||
@@ -9,7 +9,7 @@ class
|
||||
EWF_LIBFCGI_CONNECTOR
|
||||
|
||||
inherit
|
||||
EWSGI_CONNECTOR
|
||||
WGI_CONNECTOR
|
||||
redefine
|
||||
initialize
|
||||
end
|
||||
@@ -46,8 +46,8 @@ feature -- Execution
|
||||
|
||||
process_fcgi_request (vars: HASH_TABLE [STRING, STRING]; a_input: like input; a_output: like output)
|
||||
local
|
||||
req: EWSGI_REQUEST_FROM_TABLE
|
||||
res: EWSGI_RESPONSE_STREAM_BUFFER
|
||||
req: WGI_REQUEST_FROM_TABLE
|
||||
res: WGI_RESPONSE_STREAM_BUFFER
|
||||
do
|
||||
create req.make (vars, a_input)
|
||||
create res.make (a_output)
|
||||
@@ -56,10 +56,10 @@ feature -- Execution
|
||||
|
||||
feature -- Input/Output
|
||||
|
||||
input: EWSGI_INPUT_STREAM
|
||||
input: WGI_INPUT_STREAM
|
||||
-- Input from client (from httpd server via FCGI)
|
||||
|
||||
output: EWSGI_OUTPUT_STREAM
|
||||
output: WGI_OUTPUT_STREAM
|
||||
-- Output to client (via httpd server/fcgi)
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
note
|
||||
description: "Summary description for GW_LIBFCGI_INPUT_STREAM."
|
||||
description: "Summary description for EWF_LIBFCGI_INPUT_STREAM."
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
@@ -9,7 +9,7 @@ class
|
||||
EWF_LIBFCGI_INPUT_STREAM
|
||||
|
||||
inherit
|
||||
EWSGI_INPUT_STREAM
|
||||
WGI_INPUT_STREAM
|
||||
|
||||
STRING_HANDLER
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class
|
||||
EWF_LIBFCGI_OUTPUT_STREAM
|
||||
|
||||
inherit
|
||||
EWSGI_OUTPUT_STREAM
|
||||
WGI_OUTPUT_STREAM
|
||||
|
||||
HTTP_STATUS_CODE_MESSAGES
|
||||
export
|
||||
|
||||
@@ -8,7 +8,7 @@ class
|
||||
EWF_NINO_CONNECTOR
|
||||
|
||||
inherit
|
||||
EWSGI_CONNECTOR
|
||||
WGI_CONNECTOR
|
||||
redefine
|
||||
initialize
|
||||
end
|
||||
@@ -73,8 +73,8 @@ feature -- Server
|
||||
|
||||
process_request (env: HASH_TABLE [STRING, STRING]; a_headers_text: STRING; a_input: HTTP_INPUT_STREAM; a_output: HTTP_OUTPUT_STREAM)
|
||||
local
|
||||
req: EWSGI_REQUEST_FROM_TABLE
|
||||
res: EWSGI_RESPONSE_STREAM_BUFFER
|
||||
req: WGI_REQUEST_FROM_TABLE
|
||||
res: WGI_RESPONSE_STREAM_BUFFER
|
||||
do
|
||||
create req.make (env, create {EWF_NINO_INPUT_STREAM}.make (a_input))
|
||||
create res.make (create {EWF_NINO_OUTPUT_STREAM}.make (a_output))
|
||||
|
||||
@@ -9,7 +9,7 @@ class
|
||||
EWF_NINO_INPUT_STREAM
|
||||
|
||||
inherit
|
||||
EWSGI_INPUT_STREAM
|
||||
WGI_INPUT_STREAM
|
||||
|
||||
create
|
||||
make
|
||||
@@ -22,7 +22,7 @@ feature {NONE} -- Initialization
|
||||
set_nino_input (a_nino_input)
|
||||
end
|
||||
|
||||
feature {EWF_NINO_CONNECTOR, EWSGI_APPLICATION} -- Nino
|
||||
feature {EWF_NINO_CONNECTOR, WGI_APPLICATION} -- Nino
|
||||
|
||||
set_nino_input (i: like nino_input)
|
||||
do
|
||||
|
||||
@@ -9,7 +9,7 @@ class
|
||||
EWF_NINO_OUTPUT_STREAM
|
||||
|
||||
inherit
|
||||
EWSGI_OUTPUT_STREAM
|
||||
WGI_OUTPUT_STREAM
|
||||
|
||||
HTTP_STATUS_CODE_MESSAGES
|
||||
export
|
||||
@@ -26,7 +26,7 @@ feature {NONE} -- Initialization
|
||||
set_nino_output (a_nino_output)
|
||||
end
|
||||
|
||||
feature {EWF_NINO_CONNECTOR, EWSGI_APPLICATION} -- Nino
|
||||
feature {EWF_NINO_CONNECTOR, WGI_APPLICATION} -- Nino
|
||||
|
||||
set_nino_output (o: like nino_output)
|
||||
do
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
note
|
||||
description: "Summary description for {DEFAULT_EWSGI_APPLICATION}."
|
||||
description: "Summary description for {DEFAULT_WGI_APPLICATION}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
DEFAULT_EWSGI_APPLICATION
|
||||
DEFAULT_WGI_APPLICATION
|
||||
|
||||
inherit
|
||||
EWSGI_APPLICATION
|
||||
WGI_APPLICATION
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_and_launch
|
||||
local
|
||||
cgi: GW_CGI_CONNECTOR
|
||||
cgi: EWF_CGI_CONNECTOR
|
||||
do
|
||||
create cgi.make (Current)
|
||||
cgi.launch
|
||||
@@ -1,21 +1,24 @@
|
||||
note
|
||||
description: "Summary description for {DEFAULT_EWSGI_APPLICATION}."
|
||||
description: "Summary description for {DEFAULT_WGI_APPLICATION}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
DEFAULT_EWSGI_APPLICATION
|
||||
DEFAULT_WGI_APPLICATION
|
||||
|
||||
inherit
|
||||
EWSGI_APPLICATION
|
||||
WGI_APPLICATION
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_and_launch
|
||||
local
|
||||
app: NINO_APPLICATION
|
||||
do
|
||||
port_number := 80
|
||||
port_number := 8123
|
||||
print ("Example: start a Nino web server on port " + port_number.out + ", %Nand reply Hello World for any request such as http://localhost:" + port_number.out + "/%N")
|
||||
(create {NINO_APPLICATION}.make_custom (agent execute, "")).listen (port_number)
|
||||
create app.make_custom (agent execute, "")
|
||||
app.listen (port_number)
|
||||
end
|
||||
|
||||
port_number: INTEGER
|
||||
@@ -12,16 +12,16 @@ create
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
make (a_callback: like {EWSGI_AGENT_APPLICATION}.callback)
|
||||
make (a_callback: like {WGI_AGENT_APPLICATION}.callback)
|
||||
-- Initialize `Current'.
|
||||
do
|
||||
make_custom (a_callback, Void)
|
||||
end
|
||||
|
||||
make_custom (a_callback: like {EWSGI_AGENT_APPLICATION}.callback; a_base_url: detachable STRING)
|
||||
make_custom (a_callback: like {WGI_AGENT_APPLICATION}.callback; a_base_url: detachable STRING)
|
||||
-- Initialize `Current'.
|
||||
local
|
||||
app: EWSGI_AGENT_APPLICATION
|
||||
app: WGI_AGENT_APPLICATION
|
||||
do
|
||||
create app.make (a_callback)
|
||||
create connector.make_with_base (app, a_base_url)
|
||||
|
||||
@@ -18,7 +18,7 @@ feature {NONE} -- Initialization
|
||||
(create {NINO_APPLICATION}.make_custom (agent execute, "")).listen (port_number)
|
||||
end
|
||||
|
||||
execute (req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER)
|
||||
execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
do
|
||||
res.write_header (200, <<["Content-Type", "text/plain"]>>)
|
||||
res.write_string ("Hello World!%N")
|
||||
|
||||
@@ -8,18 +8,18 @@ class
|
||||
HELLO_WORLD
|
||||
|
||||
inherit
|
||||
EWSGI_RESPONSE_APPLICATION
|
||||
WGI_RESPONSE_APPLICATION
|
||||
|
||||
DEFAULT_EWSGI_APPLICATION
|
||||
DEFAULT_WGI_APPLICATION
|
||||
|
||||
create
|
||||
make_and_launch
|
||||
|
||||
feature -- Response
|
||||
|
||||
response (request: EWSGI_REQUEST): EWSGI_RESPONSE
|
||||
response (request: WGI_REQUEST): WGI_RESPONSE
|
||||
do
|
||||
if request.environment.path_info.starts_with ("/streaming/") then
|
||||
if request.path_info.starts_with ("/streaming/") then
|
||||
Result := streaming_response (request)
|
||||
else
|
||||
create Result.make
|
||||
@@ -29,7 +29,7 @@ feature -- Response
|
||||
end
|
||||
end
|
||||
|
||||
streaming_response (request: EWSGI_REQUEST): EWSGI_RESPONSE
|
||||
streaming_response (request: WGI_REQUEST): WGI_RESPONSE
|
||||
do
|
||||
create {HELLO_WORLD_RESPONSE} Result.make
|
||||
Result.set_status (200)
|
||||
|
||||
@@ -6,7 +6,7 @@ note
|
||||
class HELLO_WORLD_RESPONSE
|
||||
|
||||
inherit
|
||||
EWSGI_RESPONSE
|
||||
WGI_RESPONSE
|
||||
redefine
|
||||
make,
|
||||
read_block
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
note
|
||||
description: "Summary description for {EWSGI_CONNECTOR}."
|
||||
description: "Summary description for {WGI_CONNECTOR}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
EWSGI_CONNECTOR
|
||||
WGI_CONNECTOR
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
@@ -22,7 +22,7 @@ feature {NONE} -- Initialization
|
||||
|
||||
feature {NONE} -- Access
|
||||
|
||||
application: EWSGI_APPLICATION
|
||||
application: WGI_APPLICATION
|
||||
-- Gateway Application
|
||||
|
||||
feature -- Server
|
||||
@@ -8,7 +8,7 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
EWSGI_COOKIE
|
||||
WGI_COOKIE
|
||||
|
||||
create
|
||||
make
|
||||
@@ -8,7 +8,7 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
EWSGI_VARIABLES [G -> STRING_GENERAL]
|
||||
WGI_VARIABLES [G -> STRING_GENERAL]
|
||||
|
||||
inherit
|
||||
ITERABLE [G]
|
||||
@@ -49,7 +49,7 @@ feature -- Access
|
||||
end
|
||||
end
|
||||
|
||||
feature {EWSGI_REQUEST, EWSGI_APPLICATION, EWSGI_CONNECTOR} -- Element change
|
||||
feature {WGI_REQUEST, WGI_APPLICATION, WGI_CONNECTOR} -- Element change
|
||||
|
||||
set_variable (a_name: STRING; a_value: G)
|
||||
require
|
||||
@@ -1,12 +1,12 @@
|
||||
note
|
||||
description: "Summary description for {EWSGI_META_NAMES}."
|
||||
description: "Summary description for {WGI_META_NAMES}."
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
EWSGI_META_NAMES
|
||||
WGI_META_NAMES
|
||||
|
||||
feature -- Access
|
||||
|
||||
@@ -71,11 +71,11 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
EWSGI_REQUEST
|
||||
WGI_REQUEST
|
||||
|
||||
feature -- Access: Input
|
||||
|
||||
input: EWSGI_INPUT_STREAM
|
||||
input: WGI_INPUT_STREAM
|
||||
-- Server input channel
|
||||
deferred
|
||||
end
|
||||
@@ -87,16 +87,16 @@ feature -- Access: extra values
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Access: CGI environment variables
|
||||
feature -- Access: CGI meta variables
|
||||
|
||||
meta_variable (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_8
|
||||
meta_variable (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
||||
-- Environment variable related to `a_name'
|
||||
require
|
||||
a_name_valid: a_name /= Void and then not a_name.is_empty
|
||||
deferred
|
||||
end
|
||||
|
||||
meta_variables: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_GENERAL]
|
||||
meta_variables: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_GENERAL]
|
||||
-- These variables are specific to requests made with HTTP.
|
||||
-- Interpretation of these variables may depend on the value of
|
||||
-- SERVER_PROTOCOL.
|
||||
@@ -128,7 +128,7 @@ feature -- Access: CGI environment variables
|
||||
|
||||
feature -- Common Gateway Interface - 1.1 8 January 1996
|
||||
|
||||
auth_type: detachable READABLE_STRING_8
|
||||
auth_type: detachable READABLE_STRING_32
|
||||
-- This variable is specific to requests made via the "http"
|
||||
-- scheme.
|
||||
--
|
||||
@@ -150,7 +150,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
||||
deferred
|
||||
end
|
||||
|
||||
content_length: detachable READABLE_STRING_8
|
||||
content_length: detachable READABLE_STRING_32
|
||||
-- This metavariable is set to the size of the message-body
|
||||
-- entity attached to the request, if any, in decimal number of
|
||||
-- octets. If no data are attached, then this metavariable is
|
||||
@@ -170,7 +170,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
||||
deferred
|
||||
end
|
||||
|
||||
content_type: detachable READABLE_STRING_8
|
||||
content_type: detachable READABLE_STRING_32
|
||||
-- If the request includes a message-body, CONTENT_TYPE is set to
|
||||
-- the Internet Media Type [9] of the attached entity if the type
|
||||
-- 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
|
||||
end
|
||||
|
||||
gateway_interface: READABLE_STRING_8
|
||||
gateway_interface: READABLE_STRING_32
|
||||
-- This metavariable is set to the dialect of CGI being used by
|
||||
-- the server to communicate with the script. Syntax:
|
||||
--
|
||||
@@ -246,7 +246,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
||||
deferred
|
||||
end
|
||||
|
||||
path_info: READABLE_STRING_8
|
||||
path_info: READABLE_STRING_32
|
||||
-- The PATH_INFO metavariable specifies a path to be interpreted
|
||||
-- by the CGI script. It identifies the resource or sub-resource
|
||||
-- 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
|
||||
end
|
||||
|
||||
path_translated: detachable READABLE_STRING_8
|
||||
path_translated: detachable READABLE_STRING_32
|
||||
-- PATH_TRANSLATED is derived by taking any path-info component
|
||||
-- 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
|
||||
@@ -323,7 +323,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
||||
deferred
|
||||
end
|
||||
|
||||
query_string: READABLE_STRING_8
|
||||
query_string: READABLE_STRING_32
|
||||
-- A URL-encoded string; the <query> part of the Script-URI. (See
|
||||
-- section 3.2.)
|
||||
--
|
||||
@@ -340,7 +340,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
||||
deferred
|
||||
end
|
||||
|
||||
remote_addr: READABLE_STRING_8
|
||||
remote_addr: READABLE_STRING_32
|
||||
-- The IP address of the client sending the request to the
|
||||
-- server. This is not necessarily that of the user agent (such
|
||||
-- as if the request came through a proxy).
|
||||
@@ -355,7 +355,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
||||
deferred
|
||||
end
|
||||
|
||||
remote_host: detachable READABLE_STRING_8
|
||||
remote_host: detachable READABLE_STRING_32
|
||||
-- The fully qualified domain name of the client sending the
|
||||
-- request to the server, if available, otherwise NULL. (See
|
||||
-- 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
|
||||
end
|
||||
|
||||
remote_ident: detachable READABLE_STRING_8
|
||||
remote_ident: detachable READABLE_STRING_32
|
||||
-- The identity information reported about the connection by a
|
||||
-- RFC 1413 [11] request to the remote agent, if available.
|
||||
-- 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
|
||||
end
|
||||
|
||||
remote_user: detachable READABLE_STRING_8
|
||||
remote_user: detachable READABLE_STRING_32
|
||||
-- If the request required authentication using the "Basic"
|
||||
-- mechanism (i.e., the AUTH_TYPE metavariable is set to
|
||||
-- "Basic"), then the value of the REMOTE_USER metavariable is
|
||||
@@ -398,7 +398,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
||||
deferred
|
||||
end
|
||||
|
||||
request_method: READABLE_STRING_8
|
||||
request_method: READABLE_STRING_32
|
||||
-- The REQUEST_METHOD metavariable is set to the method with
|
||||
-- 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
|
||||
@@ -419,7 +419,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
||||
deferred
|
||||
end
|
||||
|
||||
script_name: READABLE_STRING_8
|
||||
script_name: READABLE_STRING_32
|
||||
-- The SCRIPT_NAME metavariable is set to a URL path that could
|
||||
-- identify the CGI script (rather than the script's output). The
|
||||
-- syntax and semantics are identical to a decoded HTTP URL
|
||||
@@ -437,7 +437,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
||||
deferred
|
||||
end
|
||||
|
||||
server_name: READABLE_STRING_8
|
||||
server_name: READABLE_STRING_32
|
||||
-- The SERVER_NAME metavariable is set to the name of the server,
|
||||
-- as derived from the <host> part of the Script-URI (see section
|
||||
-- 3.2).
|
||||
@@ -463,7 +463,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
||||
deferred
|
||||
end
|
||||
|
||||
server_protocol: READABLE_STRING_8
|
||||
server_protocol: READABLE_STRING_32
|
||||
-- The SERVER_PROTOCOL metavariable is set to the name and
|
||||
-- revision of the information protocol with which the request
|
||||
-- arrived. This is not necessarily the same as the protocol
|
||||
@@ -491,7 +491,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
||||
deferred
|
||||
end
|
||||
|
||||
server_software: READABLE_STRING_8
|
||||
server_software: READABLE_STRING_32
|
||||
-- The SERVER_SOFTWARE metavariable is set to the name and
|
||||
-- version of the information server software answering the
|
||||
-- request (and running the gateway).
|
||||
@@ -506,42 +506,42 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
||||
|
||||
feature -- HTTP_*
|
||||
|
||||
http_accept: detachable READABLE_STRING_8
|
||||
http_accept: detachable READABLE_STRING_32
|
||||
-- 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 READABLE_STRING_8
|
||||
http_accept_charset: detachable READABLE_STRING_32
|
||||
-- Contents of the Accept-Charset: header from the current request, if there is one.
|
||||
-- Example: 'iso-8859-1,*,utf-8'.
|
||||
deferred
|
||||
end
|
||||
|
||||
http_accept_encoding: detachable READABLE_STRING_8
|
||||
http_accept_encoding: detachable READABLE_STRING_32
|
||||
-- Contents of the Accept-Encoding: header from the current request, if there is one.
|
||||
-- Example: 'gzip'.
|
||||
deferred
|
||||
end
|
||||
|
||||
http_accept_language: detachable READABLE_STRING_8
|
||||
http_accept_language: detachable READABLE_STRING_32
|
||||
-- Contents of the Accept-Language: header from the current request, if there is one.
|
||||
-- Example: 'en'.
|
||||
deferred
|
||||
end
|
||||
|
||||
http_connection: detachable READABLE_STRING_8
|
||||
http_connection: detachable READABLE_STRING_32
|
||||
-- Contents of the Connection: header from the current request, if there is one.
|
||||
-- Example: 'Keep-Alive'.
|
||||
deferred
|
||||
end
|
||||
|
||||
http_host: detachable READABLE_STRING_8
|
||||
http_host: detachable READABLE_STRING_32
|
||||
-- Contents of the Host: header from the current request, if there is one.
|
||||
deferred
|
||||
end
|
||||
|
||||
http_referer: detachable READABLE_STRING_8
|
||||
http_referer: detachable READABLE_STRING_32
|
||||
-- The address of the page (if any) which referred the user agent to the current page.
|
||||
-- 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.
|
||||
@@ -549,7 +549,7 @@ feature -- HTTP_*
|
||||
deferred
|
||||
end
|
||||
|
||||
http_user_agent: detachable READABLE_STRING_8
|
||||
http_user_agent: detachable READABLE_STRING_32
|
||||
-- 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.
|
||||
-- A typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586).
|
||||
@@ -558,26 +558,26 @@ feature -- HTTP_*
|
||||
deferred
|
||||
end
|
||||
|
||||
http_authorization: detachable READABLE_STRING_8
|
||||
http_authorization: detachable READABLE_STRING_32
|
||||
-- Contents of the Authorization: header from the current request, if there is one.
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Extra CGI environment variables
|
||||
|
||||
request_uri: READABLE_STRING_8
|
||||
request_uri: READABLE_STRING_32
|
||||
-- The URI which was given in order to access this page; for instance, '/index.html'.
|
||||
deferred
|
||||
end
|
||||
|
||||
orig_path_info: detachable READABLE_STRING_8
|
||||
orig_path_info: detachable READABLE_STRING_32
|
||||
-- Original version of `path_info' before processed by Current environment
|
||||
deferred
|
||||
end
|
||||
|
||||
--feature -- Access: execution variables
|
||||
|
||||
-- execution_variables: EWSGI_VARIABLES [STRING_32]
|
||||
-- execution_variables: WGI_VARIABLES [STRING_32]
|
||||
-- -- Execution variables set by the application
|
||||
-- deferred
|
||||
-- end
|
||||
@@ -617,7 +617,7 @@ feature -- Form fields and related
|
||||
deferred
|
||||
end
|
||||
|
||||
uploaded_files: HASH_TABLE [EWSGI_UPLOADED_FILE_DATA, READABLE_STRING_GENERAL]
|
||||
uploaded_files: HASH_TABLE [WGI_UPLOADED_FILE_DATA, READABLE_STRING_GENERAL]
|
||||
-- Table of uploaded files information
|
||||
--| name: original path from the user
|
||||
--| type: content type
|
||||
@@ -689,10 +689,10 @@ invariant
|
||||
query_string_attached: query_string /= Void
|
||||
remote_addr_attached: remote_addr /= Void
|
||||
|
||||
same_orig_path_info: orig_path_info ~ meta_variable ({EWSGI_META_NAMES}.orig_path_info)
|
||||
same_path_info: path_info ~ meta_variable ({EWSGI_META_NAMES}.path_info)
|
||||
same_orig_path_info: orig_path_info ~ meta_variable ({WGI_META_NAMES}.orig_path_info)
|
||||
same_path_info: path_info ~ meta_variable ({WGI_META_NAMES}.path_info)
|
||||
|
||||
path_info_identical: path_info ~ meta_variable ({EWSGI_META_NAMES}.path_info)
|
||||
path_info_identical: path_info ~ meta_variable ({WGI_META_NAMES}.path_info)
|
||||
|
||||
note
|
||||
copyright: "2011-2011, Eiffel Software and others"
|
||||
@@ -1,11 +1,11 @@
|
||||
note
|
||||
description: "Summary description for {GW_UPLOADED_FILE}."
|
||||
description: "Summary description for {WGI_UPLOADED_FILE_DATA}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
EWSGI_UPLOADED_FILE_DATA
|
||||
WGI_UPLOADED_FILE_DATA
|
||||
|
||||
create
|
||||
make
|
||||
@@ -1,13 +1,13 @@
|
||||
note
|
||||
description: "Summary description for {EWSGI_RESPONSE_BUFFER}."
|
||||
description: "Summary description for {WGI_RESPONSE_BUFFER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
EWSGI_RESPONSE_BUFFER
|
||||
WGI_RESPONSE_BUFFER
|
||||
|
||||
feature {EWSGI_APPLICATION} -- Commit
|
||||
feature {WGI_APPLICATION} -- Commit
|
||||
|
||||
commit
|
||||
-- Commit the current response
|
||||
@@ -35,7 +35,7 @@ feature -- Status report
|
||||
deferred
|
||||
end
|
||||
|
||||
feature {EWSGI_RESPONSE_BUFFER} -- Core output operation
|
||||
feature {WGI_RESPONSE_BUFFER} -- Core output operation
|
||||
|
||||
write (s: STRING)
|
||||
-- Send the string `s'
|
||||
@@ -8,7 +8,7 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
EWSGI_INPUT_STREAM
|
||||
WGI_INPUT_STREAM
|
||||
|
||||
feature -- Access
|
||||
|
||||
@@ -8,7 +8,7 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
EWSGI_OUTPUT_STREAM
|
||||
WGI_OUTPUT_STREAM
|
||||
|
||||
feature -- Core operation
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
note
|
||||
description: "Summary description for {EWSGI_APPLICATION}."
|
||||
description: "Summary description for {WGI_APPLICATION}."
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
EWSGI_APPLICATION
|
||||
WGI_APPLICATION
|
||||
|
||||
feature {NONE} -- Execution
|
||||
|
||||
execute (req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER)
|
||||
execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
-- Execute the request
|
||||
-- See `req.input' for input stream
|
||||
-- `req.environment' for the Gateway environment
|
||||
@@ -1,14 +1,14 @@
|
||||
note
|
||||
description: "Summary description for {EWSGI_AGENT_APPLICATION}."
|
||||
description: "Summary description for {WGI_AGENT_APPLICATION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
EWSGI_AGENT_APPLICATION
|
||||
WGI_AGENT_APPLICATION
|
||||
|
||||
inherit
|
||||
EWSGI_APPLICATION
|
||||
WGI_APPLICATION
|
||||
|
||||
create
|
||||
make
|
||||
@@ -23,10 +23,10 @@ feature {NONE} -- Implementation
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
callback: PROCEDURE [ANY, TUPLE [req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER]]
|
||||
callback: PROCEDURE [ANY, TUPLE [req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER]]
|
||||
-- Procedure called on `execute'
|
||||
|
||||
execute (req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER)
|
||||
execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
-- Execute the request
|
||||
do
|
||||
callback.call ([req, res])
|
||||
@@ -1,6 +1,6 @@
|
||||
note
|
||||
description: "[
|
||||
EWSGI_APPLICATION
|
||||
WGI_APPLICATION
|
||||
]"
|
||||
specification: "EWSGI specification https://github.com/Eiffel-World/Eiffel-Web-Framework/wiki/EWSGI-specification"
|
||||
legal: "See notice at end of class."
|
||||
@@ -9,11 +9,11 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
EWSGI_APPLICATION
|
||||
WGI_APPLICATION
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER)
|
||||
execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
-- Execute the request
|
||||
-- See `req.input' for input stream
|
||||
-- `req.environment' for the Gateway environment
|
||||
@@ -28,7 +28,7 @@ feature -- Execution
|
||||
|
||||
feature -- Process request
|
||||
|
||||
process (req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER)
|
||||
process (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
-- Process request with environment `env', and i/o streams `a_input' and `a_output'
|
||||
local
|
||||
rescued: BOOLEAN
|
||||
@@ -53,17 +53,17 @@ feature -- Access
|
||||
|
||||
feature {NONE} -- Execution
|
||||
|
||||
pre_execute (req: EWSGI_REQUEST)
|
||||
pre_execute (req: WGI_REQUEST)
|
||||
-- Operation processed before `execute'
|
||||
do
|
||||
end
|
||||
|
||||
post_execute (req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER)
|
||||
post_execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
-- Operation processed after `execute', or after `rescue_execute'
|
||||
do
|
||||
end
|
||||
|
||||
rescue_execute (req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER; a_exception: detachable EXCEPTION)
|
||||
rescue_execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER; a_exception: detachable EXCEPTION)
|
||||
-- Operation processed on rescue of `execute'
|
||||
do
|
||||
if
|
||||
@@ -1,11 +1,11 @@
|
||||
note
|
||||
description: "Summary description for {EWSGI_CONNECTOR}."
|
||||
description: "Summary description for {WGI_CONNECTOR}."
|
||||
specification: "EWSGI/connector specification https://github.com/Eiffel-World/Eiffel-Web-Framework/wiki/EWSGI-specification"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
EWSGI_CONNECTOR
|
||||
WGI_CONNECTOR
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
@@ -22,7 +22,7 @@ feature {NONE} -- Initialization
|
||||
|
||||
feature {NONE} -- Access
|
||||
|
||||
application: EWSGI_APPLICATION
|
||||
application: WGI_APPLICATION
|
||||
-- Gateway Application
|
||||
|
||||
feature -- Server
|
||||
@@ -8,9 +8,9 @@ class
|
||||
EWF_BUFFERED_RESPONSE
|
||||
|
||||
inherit
|
||||
EWSGI_RESPONSE_BUFFER
|
||||
WGI_RESPONSE_BUFFER
|
||||
|
||||
create {EWSGI_APPLICATION}
|
||||
create {WGI_APPLICATION}
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
@@ -22,7 +22,7 @@ feature {NONE} -- Initialization
|
||||
create buffer.make (a_buffer_size)
|
||||
end
|
||||
|
||||
response_buffer: EWSGI_RESPONSE_BUFFER
|
||||
response_buffer: WGI_RESPONSE_BUFFER
|
||||
|
||||
buffer: STRING_8
|
||||
|
||||
@@ -79,7 +79,7 @@ feature {NONE} -- Implementation
|
||||
buffer_flushed: buffer_count = 0 and buffer.count = 0
|
||||
end
|
||||
|
||||
feature {EWSGI_APPLICATION} -- Commit
|
||||
feature {WGI_APPLICATION} -- Commit
|
||||
|
||||
commit
|
||||
do
|
||||
|
||||
@@ -7,27 +7,27 @@ class
|
||||
EWF_IN_MEMORY_RESPONSE
|
||||
|
||||
inherit
|
||||
EWSGI_RESPONSE_BUFFER
|
||||
WGI_RESPONSE_BUFFER
|
||||
|
||||
create {EWSGI_APPLICATION}
|
||||
create {WGI_APPLICATION}
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (res: EWSGI_RESPONSE_BUFFER)
|
||||
make (res: WGI_RESPONSE_BUFFER)
|
||||
do
|
||||
response_buffer := res
|
||||
create header.make
|
||||
create body.make (100)
|
||||
end
|
||||
|
||||
response_buffer: EWSGI_RESPONSE_BUFFER
|
||||
response_buffer: WGI_RESPONSE_BUFFER
|
||||
|
||||
header: EWF_HEADER
|
||||
|
||||
body: STRING_8
|
||||
|
||||
feature {EWSGI_APPLICATION} -- Commit
|
||||
feature {WGI_APPLICATION} -- Commit
|
||||
|
||||
commit
|
||||
local
|
||||
|
||||
@@ -8,7 +8,7 @@ deferred class
|
||||
EWF_IN_MEMORY_RESPONSE_APPLICATION
|
||||
|
||||
inherit
|
||||
EWSGI_APPLICATION
|
||||
WGI_APPLICATION
|
||||
rename
|
||||
execute as app_execute
|
||||
end
|
||||
@@ -16,7 +16,7 @@ inherit
|
||||
|
||||
feature -- Execution
|
||||
|
||||
app_execute (req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER)
|
||||
app_execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
-- Execute the request
|
||||
-- See `req.input' for input stream
|
||||
-- `req.environment' for the Gateway environment
|
||||
@@ -27,7 +27,7 @@ feature -- Execution
|
||||
|
||||
feature -- Execute
|
||||
|
||||
execute (req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER)
|
||||
execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
-- Execute the request
|
||||
-- See `req.input' for input stream
|
||||
-- `req.environment' for the Gateway environment
|
||||
@@ -41,7 +41,7 @@ feature -- Execute
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
new_response (req: EWSGI_REQUEST; a_res: EWSGI_RESPONSE_BUFFER): EWF_IN_MEMORY_RESPONSE
|
||||
new_response (req: WGI_REQUEST; a_res: WGI_RESPONSE_BUFFER): EWF_IN_MEMORY_RESPONSE
|
||||
do
|
||||
create {EWF_IN_MEMORY_RESPONSE} Result.make (a_res)
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ note
|
||||
author: "Paul Cohen <paul.cohen@seibostudio.se>"
|
||||
status: "Draft"
|
||||
|
||||
class EWSGI_RESPONSE
|
||||
class WGI_RESPONSE
|
||||
|
||||
create
|
||||
make
|
||||
@@ -26,9 +26,9 @@ feature {NONE} -- Initialization
|
||||
create headers_table.make (10)
|
||||
end
|
||||
|
||||
feature {EWSGI_RESPONSE_APPLICATION} -- Response status
|
||||
feature {WGI_RESPONSE_APPLICATION} -- Response status
|
||||
|
||||
transmit_to (res: EWSGI_RESPONSE_BUFFER)
|
||||
transmit_to (res: WGI_RESPONSE_BUFFER)
|
||||
do
|
||||
res.set_status_code (status)
|
||||
res.write_headers_string (headers)
|
||||
@@ -64,7 +64,7 @@ feature {EWSGI_RESPONSE_APPLICATION} -- Response status
|
||||
ready_to_transmit
|
||||
end
|
||||
|
||||
feature {EWSGI_RESPONSE_APPLICATION} -- Message start line and status
|
||||
feature {WGI_RESPONSE_APPLICATION} -- Message start line and status
|
||||
|
||||
status: INTEGER
|
||||
-- HTTP status code
|
||||
@@ -88,7 +88,7 @@ feature {EWSGI_RESPONSE_APPLICATION} -- Message start line and status
|
||||
end
|
||||
end
|
||||
|
||||
feature {EWSGI_RESPONSE_APPLICATION} -- Message headers
|
||||
feature {WGI_RESPONSE_APPLICATION} -- Message headers
|
||||
|
||||
headers: STRING
|
||||
-- HTTP message headers including trailing empty line.
|
||||
@@ -119,7 +119,7 @@ feature {EWSGI_RESPONSE_APPLICATION} -- Message headers
|
||||
headers_table.has (key) and headers_table @ key = value
|
||||
end
|
||||
|
||||
feature {EWSGI_RESPONSE_APPLICATION} -- Message body
|
||||
feature {WGI_RESPONSE_APPLICATION} -- Message body
|
||||
|
||||
read_block
|
||||
-- Read a message body block.
|
||||
@@ -1,22 +1,22 @@
|
||||
note
|
||||
description: "Summary description for {EWSGI_RESPONSE_APPLICATION} "
|
||||
description: "Summary description for {WGI_RESPONSE_APPLICATION} "
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
EWSGI_RESPONSE_APPLICATION
|
||||
WGI_RESPONSE_APPLICATION
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER)
|
||||
execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
-- Execute the request
|
||||
-- See `req.input' for input stream
|
||||
-- `req.environment' for the Gateway environment
|
||||
-- and `res.output' for output stream
|
||||
local
|
||||
rs: EWSGI_RESPONSE
|
||||
rs: WGI_RESPONSE
|
||||
do
|
||||
rs := response (req)
|
||||
if rs.ready_to_transmit then
|
||||
@@ -24,7 +24,7 @@ feature -- Execution
|
||||
else
|
||||
-- Report internal server error.
|
||||
-- Response not ready to transmit!
|
||||
-- Implementor of EWSGI_APPLICATION has not done his job!
|
||||
-- Implementor of WGI_APPLICATION has not done his job!
|
||||
create rs.make
|
||||
rs.set_status (500)
|
||||
rs.set_header ("Content-Type", "text/plain")
|
||||
@@ -35,7 +35,7 @@ feature -- Execution
|
||||
|
||||
feature -- Response
|
||||
|
||||
response (request: EWSGI_REQUEST): EWSGI_RESPONSE
|
||||
response (request: WGI_REQUEST): WGI_RESPONSE
|
||||
-- HTTP response for given 'request'.
|
||||
deferred
|
||||
ensure
|
||||
@@ -9,17 +9,17 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
EWSGI_REQUEST_FROM_TABLE
|
||||
WGI_REQUEST_FROM_TABLE
|
||||
|
||||
inherit
|
||||
EWSGI_REQUEST
|
||||
WGI_REQUEST
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_vars: HASH_TABLE [STRING, STRING]; a_input: like input)
|
||||
make (a_vars: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_8]; a_input: like input)
|
||||
require
|
||||
vars_attached: a_vars /= Void
|
||||
do
|
||||
@@ -34,11 +34,11 @@ feature {NONE} -- Initialization
|
||||
analyze
|
||||
end
|
||||
|
||||
set_meta_parameters (a_vars: HASH_TABLE [STRING, STRING])
|
||||
set_meta_parameters (a_vars: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_8])
|
||||
-- Fill with variable from `a_vars'
|
||||
local
|
||||
s: detachable READABLE_STRING_8
|
||||
table: HASH_TABLE [STRING, STRING]
|
||||
s: like meta_variable
|
||||
table: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_GENERAL]
|
||||
do
|
||||
create empty_string.make_empty
|
||||
|
||||
@@ -54,13 +54,13 @@ feature {NONE} -- Initialization
|
||||
end
|
||||
|
||||
--| QUERY_STRING
|
||||
query_string := meta_parameter_or_default ({EWSGI_META_NAMES}.query_string, empty_string, False)
|
||||
query_string := meta_parameter_or_default ({WGI_META_NAMES}.query_string, empty_string, False)
|
||||
|
||||
--| REQUEST_METHOD
|
||||
request_method := meta_parameter_or_default ({EWSGI_META_NAMES}.request_method, empty_string, False)
|
||||
request_method := meta_parameter_or_default ({WGI_META_NAMES}.request_method, empty_string, False)
|
||||
|
||||
--| CONTENT_TYPE
|
||||
s := meta_variable ({EWSGI_META_NAMES}.content_type)
|
||||
s := meta_variable ({WGI_META_NAMES}.content_type)
|
||||
if s /= Void and then not s.is_empty then
|
||||
content_type := s
|
||||
else
|
||||
@@ -68,7 +68,7 @@ feature {NONE} -- Initialization
|
||||
end
|
||||
|
||||
--| CONTENT_LENGTH
|
||||
s := meta_variable ({EWSGI_META_NAMES}.content_length)
|
||||
s := meta_variable ({WGI_META_NAMES}.content_length)
|
||||
content_length := s
|
||||
if s /= Void and then s.is_natural_64 then
|
||||
content_length_value := s.to_natural_64
|
||||
@@ -77,13 +77,13 @@ feature {NONE} -- Initialization
|
||||
end
|
||||
|
||||
--| PATH_INFO
|
||||
path_info := meta_parameter_or_default ({EWSGI_META_NAMES}.path_info, empty_string, False)
|
||||
path_info := meta_parameter_or_default ({WGI_META_NAMES}.path_info, empty_string, False)
|
||||
|
||||
--| SERVER_NAME
|
||||
server_name := meta_parameter_or_default ({EWSGI_META_NAMES}.server_name, empty_string, False)
|
||||
server_name := meta_parameter_or_default ({WGI_META_NAMES}.server_name, empty_string, False)
|
||||
|
||||
--| SERVER_PORT
|
||||
s := meta_variable ({EWSGI_META_NAMES}.server_port)
|
||||
s := meta_variable ({WGI_META_NAMES}.server_port)
|
||||
if s /= Void and then s.is_integer then
|
||||
server_port := s.to_integer
|
||||
else
|
||||
@@ -91,16 +91,16 @@ feature {NONE} -- Initialization
|
||||
end
|
||||
|
||||
--| SCRIPT_NAME
|
||||
script_name := meta_parameter_or_default ({EWSGI_META_NAMES}.script_name, empty_string, False)
|
||||
script_name := meta_parameter_or_default ({WGI_META_NAMES}.script_name, empty_string, False)
|
||||
|
||||
--| REMOTE_ADDR
|
||||
remote_addr := meta_parameter_or_default ({EWSGI_META_NAMES}.remote_addr, empty_string, False)
|
||||
remote_addr := meta_parameter_or_default ({WGI_META_NAMES}.remote_addr, empty_string, False)
|
||||
|
||||
--| REMOTE_HOST
|
||||
remote_host := meta_parameter_or_default ({EWSGI_META_NAMES}.remote_host, empty_string, False)
|
||||
remote_host := meta_parameter_or_default ({WGI_META_NAMES}.remote_host, empty_string, False)
|
||||
|
||||
--| REQUEST_URI
|
||||
request_uri := meta_parameter_or_default ({EWSGI_META_NAMES}.request_uri, empty_string, False)
|
||||
request_uri := meta_parameter_or_default ({WGI_META_NAMES}.request_uri, empty_string, False)
|
||||
end
|
||||
|
||||
initialize
|
||||
@@ -114,13 +114,13 @@ feature {NONE} -- Initialization
|
||||
if attached request_uri as rq_uri then
|
||||
p := rq_uri.index_of ('?', 1)
|
||||
if p > 0 then
|
||||
set_meta_parameter (rq_uri.substring (1, p-1), {EWSGI_META_NAMES}.self)
|
||||
set_meta_parameter (rq_uri.substring (1, p-1), {WGI_META_NAMES}.self)
|
||||
else
|
||||
set_meta_parameter (rq_uri, {EWSGI_META_NAMES}.self)
|
||||
set_meta_parameter (rq_uri, {WGI_META_NAMES}.self)
|
||||
end
|
||||
end
|
||||
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)
|
||||
if meta_variable ({WGI_META_NAMES}.request_time) = Void then
|
||||
set_meta_parameter (date_time_utilities.unix_time_stamp (Void).out, {WGI_META_NAMES}.request_time)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -151,7 +151,7 @@ feature -- Error handling
|
||||
|
||||
feature -- Access: Input
|
||||
|
||||
input: EWSGI_INPUT_STREAM
|
||||
input: WGI_INPUT_STREAM
|
||||
-- Server input channel
|
||||
|
||||
feature -- Access extra information
|
||||
@@ -160,7 +160,7 @@ feature -- Access extra information
|
||||
-- Request time (UTC)
|
||||
do
|
||||
if
|
||||
attached meta_variable ({EWSGI_META_NAMES}.request_time) as t and then
|
||||
attached meta_variable ({WGI_META_NAMES}.request_time) as t and then
|
||||
t.is_integer_64
|
||||
then
|
||||
Result := date_time_utilities.unix_time_stamp_to_date_time (t.to_integer_64)
|
||||
@@ -169,16 +169,16 @@ feature -- Access extra information
|
||||
|
||||
feature -- Access: CGI meta parameters
|
||||
|
||||
meta_variables: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_GENERAL]
|
||||
meta_variables: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_GENERAL]
|
||||
-- CGI Environment parameters
|
||||
|
||||
meta_variable (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_8
|
||||
meta_variable (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
||||
-- CGI meta variable related to `a_name'
|
||||
do
|
||||
Result := meta_variables.item (a_name)
|
||||
end
|
||||
|
||||
meta_parameter_or_default (a_name: READABLE_STRING_GENERAL; a_default: READABLE_STRING_8; use_default_when_empty: BOOLEAN): READABLE_STRING_8
|
||||
meta_parameter_or_default (a_name: READABLE_STRING_GENERAL; a_default: READABLE_STRING_32; use_default_when_empty: BOOLEAN): READABLE_STRING_32
|
||||
-- Value for meta parameter `a_name'
|
||||
-- If not found, return `a_default'
|
||||
require
|
||||
@@ -195,7 +195,7 @@ feature -- Access: CGI meta parameters
|
||||
end
|
||||
end
|
||||
|
||||
set_meta_parameter (a_name: READABLE_STRING_GENERAL; a_value: STRING)
|
||||
set_meta_parameter (a_name: READABLE_STRING_GENERAL; a_value: READABLE_STRING_32)
|
||||
do
|
||||
meta_variables.force (a_value, a_name)
|
||||
ensure
|
||||
@@ -211,20 +211,20 @@ feature -- Access: CGI meta parameters
|
||||
|
||||
feature -- Access: CGI meta parameters - 1.1
|
||||
|
||||
auth_type: detachable READABLE_STRING_8
|
||||
auth_type: detachable READABLE_STRING_32
|
||||
|
||||
content_length: detachable READABLE_STRING_8
|
||||
content_length: detachable READABLE_STRING_32
|
||||
|
||||
content_length_value: NATURAL_64
|
||||
|
||||
content_type: detachable READABLE_STRING_8
|
||||
content_type: detachable READABLE_STRING_32
|
||||
|
||||
gateway_interface: READABLE_STRING_8
|
||||
gateway_interface: READABLE_STRING_32
|
||||
do
|
||||
Result := meta_parameter_or_default ({EWSGI_META_NAMES}.gateway_interface, "", False)
|
||||
Result := meta_parameter_or_default ({WGI_META_NAMES}.gateway_interface, "", False)
|
||||
end
|
||||
|
||||
path_info: READABLE_STRING_8
|
||||
path_info: READABLE_STRING_32
|
||||
-- <Precursor/>
|
||||
--
|
||||
--| For instance, if the current script was accessed via the URL
|
||||
@@ -232,138 +232,138 @@ feature -- Access: CGI meta parameters - 1.1
|
||||
--|
|
||||
--| Note that is the PATH_INFO variable does not exists, the `path_info' value will be empty
|
||||
|
||||
path_translated: detachable READABLE_STRING_8
|
||||
path_translated: detachable READABLE_STRING_32
|
||||
do
|
||||
Result := meta_variable ({EWSGI_META_NAMES}.path_translated)
|
||||
Result := meta_variable ({WGI_META_NAMES}.path_translated)
|
||||
end
|
||||
|
||||
query_string: READABLE_STRING_8
|
||||
query_string: READABLE_STRING_32
|
||||
|
||||
remote_addr: READABLE_STRING_8
|
||||
remote_addr: READABLE_STRING_32
|
||||
|
||||
remote_host: READABLE_STRING_8
|
||||
remote_host: READABLE_STRING_32
|
||||
|
||||
remote_ident: detachable READABLE_STRING_8
|
||||
remote_ident: detachable READABLE_STRING_32
|
||||
do
|
||||
Result := meta_variable ({EWSGI_META_NAMES}.remote_ident)
|
||||
Result := meta_variable ({WGI_META_NAMES}.remote_ident)
|
||||
end
|
||||
|
||||
remote_user: detachable READABLE_STRING_8
|
||||
remote_user: detachable READABLE_STRING_32
|
||||
do
|
||||
Result := meta_variable ({EWSGI_META_NAMES}.remote_user)
|
||||
Result := meta_variable ({WGI_META_NAMES}.remote_user)
|
||||
end
|
||||
|
||||
request_method: READABLE_STRING_8
|
||||
request_method: READABLE_STRING_32
|
||||
|
||||
script_name: READABLE_STRING_8
|
||||
script_name: READABLE_STRING_32
|
||||
|
||||
server_name: READABLE_STRING_8
|
||||
server_name: READABLE_STRING_32
|
||||
|
||||
server_port: INTEGER
|
||||
|
||||
server_protocol: READABLE_STRING_8
|
||||
server_protocol: READABLE_STRING_32
|
||||
do
|
||||
Result := meta_parameter_or_default ({EWSGI_META_NAMES}.server_protocol, "HTTP/1.0", True)
|
||||
Result := meta_parameter_or_default ({WGI_META_NAMES}.server_protocol, "HTTP/1.0", True)
|
||||
end
|
||||
|
||||
server_software: READABLE_STRING_8
|
||||
server_software: READABLE_STRING_32
|
||||
do
|
||||
Result := meta_parameter_or_default ({EWSGI_META_NAMES}.server_software, "Unknown Server", True)
|
||||
Result := meta_parameter_or_default ({WGI_META_NAMES}.server_software, "Unknown Server", True)
|
||||
end
|
||||
|
||||
feature -- Access: HTTP_* CGI meta parameters - 1.1
|
||||
|
||||
http_accept: detachable READABLE_STRING_8
|
||||
http_accept: detachable READABLE_STRING_32
|
||||
-- Contents of the Accept: header from the current request, if there is one.
|
||||
do
|
||||
Result := meta_variable ({EWSGI_META_NAMES}.http_accept)
|
||||
Result := meta_variable ({WGI_META_NAMES}.http_accept)
|
||||
end
|
||||
|
||||
http_accept_charset: detachable READABLE_STRING_8
|
||||
http_accept_charset: detachable READABLE_STRING_32
|
||||
-- Contents of the Accept-Charset: header from the current request, if there is one.
|
||||
-- Example: 'iso-8859-1,*,utf-8'.
|
||||
do
|
||||
Result := meta_variable ({EWSGI_META_NAMES}.http_accept_charset)
|
||||
Result := meta_variable ({WGI_META_NAMES}.http_accept_charset)
|
||||
end
|
||||
|
||||
http_accept_encoding: detachable READABLE_STRING_8
|
||||
http_accept_encoding: detachable READABLE_STRING_32
|
||||
-- Contents of the Accept-Encoding: header from the current request, if there is one.
|
||||
-- Example: 'gzip'.
|
||||
do
|
||||
Result := meta_variable ({EWSGI_META_NAMES}.http_accept_encoding)
|
||||
Result := meta_variable ({WGI_META_NAMES}.http_accept_encoding)
|
||||
end
|
||||
|
||||
http_accept_language: detachable READABLE_STRING_8
|
||||
http_accept_language: detachable READABLE_STRING_32
|
||||
-- Contents of the Accept-Language: header from the current request, if there is one.
|
||||
-- Example: 'en'.
|
||||
do
|
||||
Result := meta_variable ({EWSGI_META_NAMES}.http_accept_language)
|
||||
Result := meta_variable ({WGI_META_NAMES}.http_accept_language)
|
||||
end
|
||||
|
||||
http_connection: detachable READABLE_STRING_8
|
||||
http_connection: detachable READABLE_STRING_32
|
||||
-- Contents of the Connection: header from the current request, if there is one.
|
||||
-- Example: 'Keep-Alive'.
|
||||
do
|
||||
Result := meta_variable ({EWSGI_META_NAMES}.http_connection)
|
||||
Result := meta_variable ({WGI_META_NAMES}.http_connection)
|
||||
end
|
||||
|
||||
http_host: detachable READABLE_STRING_8
|
||||
http_host: detachable READABLE_STRING_32
|
||||
-- Contents of the Host: header from the current request, if there is one.
|
||||
do
|
||||
Result := meta_variable ({EWSGI_META_NAMES}.http_host)
|
||||
Result := meta_variable ({WGI_META_NAMES}.http_host)
|
||||
end
|
||||
|
||||
http_referer: detachable READABLE_STRING_8
|
||||
http_referer: detachable READABLE_STRING_32
|
||||
-- The address of the page (if any) which referred the user agent to the current page.
|
||||
-- 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.
|
||||
-- In short, it cannot really be trusted.
|
||||
do
|
||||
Result := meta_variable ({EWSGI_META_NAMES}.http_referer)
|
||||
Result := meta_variable ({WGI_META_NAMES}.http_referer)
|
||||
end
|
||||
|
||||
http_user_agent: detachable READABLE_STRING_8
|
||||
http_user_agent: detachable READABLE_STRING_32
|
||||
-- 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.
|
||||
-- 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
|
||||
-- output to the capabilities of the user agent.
|
||||
do
|
||||
Result := meta_variable ({EWSGI_META_NAMES}.http_user_agent)
|
||||
Result := meta_variable ({WGI_META_NAMES}.http_user_agent)
|
||||
end
|
||||
|
||||
http_authorization: detachable READABLE_STRING_8
|
||||
http_authorization: detachable READABLE_STRING_32
|
||||
-- Contents of the Authorization: header from the current request, if there is one.
|
||||
do
|
||||
Result := meta_variable ({EWSGI_META_NAMES}.http_authorization)
|
||||
Result := meta_variable ({WGI_META_NAMES}.http_authorization)
|
||||
end
|
||||
|
||||
feature -- Access: Extension to CGI meta parameters - 1.1
|
||||
|
||||
request_uri: STRING
|
||||
request_uri: READABLE_STRING_32
|
||||
-- The URI which was given in order to access this page; for instance, '/index.html'.
|
||||
|
||||
orig_path_info: detachable STRING
|
||||
orig_path_info: detachable READABLE_STRING_32
|
||||
-- Original version of `path_info' before processed by Current environment
|
||||
|
||||
feature {NONE} -- Element change: CGI meta parameter related to PATH_INFO
|
||||
|
||||
set_orig_path_info (s: STRING)
|
||||
set_orig_path_info (s: READABLE_STRING_32)
|
||||
-- Set ORIG_PATH_INFO to `s'
|
||||
require
|
||||
s_attached: s /= Void
|
||||
do
|
||||
orig_path_info := s
|
||||
set_meta_parameter ({EWSGI_META_NAMES}.orig_path_info, s)
|
||||
set_meta_parameter ({WGI_META_NAMES}.orig_path_info, s)
|
||||
end
|
||||
|
||||
unset_orig_path_info
|
||||
-- Unset ORIG_PATH_INFO
|
||||
do
|
||||
orig_path_info := Void
|
||||
unset_meta_parameter ({EWSGI_META_NAMES}.orig_path_info)
|
||||
unset_meta_parameter ({WGI_META_NAMES}.orig_path_info)
|
||||
ensure
|
||||
unset: attached meta_variable ({EWSGI_META_NAMES}.orig_path_info)
|
||||
unset: attached meta_variable ({WGI_META_NAMES}.orig_path_info)
|
||||
end
|
||||
|
||||
update_path_info
|
||||
@@ -518,7 +518,7 @@ feature -- Form fields and related
|
||||
Result := form_data_parameters.item (a_name)
|
||||
end
|
||||
|
||||
uploaded_files: HASH_TABLE [EWSGI_UPLOADED_FILE_DATA, STRING]
|
||||
uploaded_files: HASH_TABLE [WGI_UPLOADED_FILE_DATA, STRING]
|
||||
-- Table of uploaded files information
|
||||
--| name: original path from the user
|
||||
--| type: content type
|
||||
@@ -538,7 +538,7 @@ feature -- Cookies
|
||||
do
|
||||
l_cookies := internal_cookies
|
||||
if l_cookies = Void then
|
||||
if attached meta_variable ({EWSGI_META_NAMES}.http_cookie) as s then
|
||||
if attached meta_variable ({WGI_META_NAMES}.http_cookie) as s then
|
||||
create l_cookies.make (5)
|
||||
from
|
||||
n := s.count
|
||||
@@ -748,7 +748,7 @@ feature -- Element change
|
||||
|
||||
feature {NONE} -- Temporary File handling
|
||||
|
||||
delete_uploaded_file (uf: EWSGI_UPLOADED_FILE_DATA)
|
||||
delete_uploaded_file (uf: WGI_UPLOADED_FILE_DATA)
|
||||
-- Delete file `a_filename'
|
||||
require
|
||||
uf_valid: uf /= Void
|
||||
@@ -771,7 +771,7 @@ feature {NONE} -- Temporary File handling
|
||||
end
|
||||
end
|
||||
|
||||
save_uploaded_file (a_content: STRING; a_up_fn_info: EWSGI_UPLOADED_FILE_DATA)
|
||||
save_uploaded_file (a_content: STRING; a_up_fn_info: WGI_UPLOADED_FILE_DATA)
|
||||
-- Save uploaded file content to `a_filename'
|
||||
local
|
||||
bn: STRING
|
||||
@@ -938,7 +938,7 @@ feature {NONE} -- Implementation: Form analyzer
|
||||
l_header: detachable STRING
|
||||
l_content: detachable STRING
|
||||
l_line: detachable STRING
|
||||
l_up_file_info: EWSGI_UPLOADED_FILE_DATA
|
||||
l_up_file_info: WGI_UPLOADED_FILE_DATA
|
||||
do
|
||||
from
|
||||
p := 1
|
||||
@@ -1115,7 +1115,7 @@ feature {NONE} -- Implementation
|
||||
extract_variables
|
||||
-- Extract relevant meta parameters
|
||||
local
|
||||
s: detachable READABLE_STRING_8
|
||||
s: detachable READABLE_STRING_32
|
||||
do
|
||||
s := request_uri
|
||||
if s.is_empty then
|
||||
@@ -8,10 +8,10 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
EWSGI_RESPONSE_STREAM_BUFFER
|
||||
WGI_RESPONSE_STREAM_BUFFER
|
||||
|
||||
inherit
|
||||
EWSGI_RESPONSE_BUFFER
|
||||
WGI_RESPONSE_BUFFER
|
||||
|
||||
create
|
||||
make
|
||||
@@ -23,7 +23,7 @@ feature {NONE} -- Initialization
|
||||
output := a_output
|
||||
end
|
||||
|
||||
feature {EWSGI_APPLICATION} -- Commit
|
||||
feature {WGI_APPLICATION} -- Commit
|
||||
|
||||
commit
|
||||
-- Commit the current response
|
||||
@@ -133,7 +133,7 @@ feature -- Output operation
|
||||
|
||||
feature {NONE} -- Implementation: Access
|
||||
|
||||
output: EWSGI_OUTPUT_STREAM
|
||||
output: WGI_OUTPUT_STREAM
|
||||
-- Server output channel
|
||||
|
||||
;note
|
||||
@@ -9,7 +9,7 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
EWSGI_INPUT_STREAM
|
||||
WGI_INPUT_STREAM
|
||||
|
||||
feature -- Access
|
||||
|
||||
@@ -9,7 +9,7 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
EWSGI_OUTPUT_STREAM
|
||||
WGI_OUTPUT_STREAM
|
||||
|
||||
feature -- Core operation
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
<option warning="true" full_class_checking="true" syntax="provisional">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="encoder" location="..\..\..\text\encoder\encoder.ecf" readonly="false"/>
|
||||
<library name="error" location="..\..\..\error\error.ecf"/>
|
||||
<library name="http" location="..\..\..\protocol\http\http.ecf"/>
|
||||
<library name="encoder" location="..\..\..\text\encoder\encoder.ecf" readonly="false"/>
|
||||
<library name="libfcgi" location="..\..\libfcgi\libfcgi.ecf"/>
|
||||
<library name="nino" location="..\..\..\..\ext\server\nino\nino.ecf" readonly="false">
|
||||
<renaming old_name="HTTP_CONSTANTS" new_name="NINO_HTTP_CONSTANTS"/>
|
||||
@@ -20,5 +20,7 @@
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||
<cluster name="connectors" location="..\connectors\" recursive="true"/>
|
||||
<cluster name="interface" location="..\src\" recursive="true"/>
|
||||
<cluster name="specification_request" location="..\specification\request" recursive="true"/>
|
||||
<cluster name="specification_response" location="..\specification\response" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
|
||||
@@ -35,7 +35,7 @@ feature -- Setup
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER)
|
||||
execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
do
|
||||
if attached router.dispatch (req, res) as r then
|
||||
--| done
|
||||
@@ -44,7 +44,7 @@ feature -- Execution
|
||||
end
|
||||
end
|
||||
|
||||
execute_default (req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER)
|
||||
execute_default (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
deferred
|
||||
end
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ inherit
|
||||
|
||||
feature -- Access
|
||||
|
||||
request: EWSGI_REQUEST
|
||||
request: WGI_REQUEST
|
||||
-- Associated request
|
||||
|
||||
path: STRING
|
||||
@@ -25,35 +25,34 @@ feature -- Access
|
||||
|
||||
request_content_type (content_type_supported: detachable ARRAY [STRING]): detachable READABLE_STRING_8
|
||||
local
|
||||
s: detachable READABLE_STRING_8
|
||||
s: detachable READABLE_STRING_32
|
||||
i,n: INTEGER
|
||||
do
|
||||
Result := request.content_type
|
||||
if Result = Void then
|
||||
s := request.http_accept
|
||||
if s /= Void then
|
||||
if attached accepted_content_types (request) as l_accept_lst then
|
||||
from
|
||||
l_accept_lst.start
|
||||
until
|
||||
l_accept_lst.after or Result /= Void
|
||||
loop
|
||||
s := l_accept_lst.item
|
||||
if content_type_supported /= Void then
|
||||
from
|
||||
i := content_type_supported.lower
|
||||
n := content_type_supported.upper
|
||||
until
|
||||
i > n or Result /= Void
|
||||
loop
|
||||
if content_type_supported[i].same_string (s) then
|
||||
Result := s
|
||||
end
|
||||
i := i + 1
|
||||
s := request.content_type
|
||||
if s /= Void then
|
||||
Result := s
|
||||
else
|
||||
if attached accepted_content_types (request) as l_accept_lst then
|
||||
from
|
||||
l_accept_lst.start
|
||||
until
|
||||
l_accept_lst.after or Result /= Void
|
||||
loop
|
||||
s := l_accept_lst.item
|
||||
if content_type_supported /= Void then
|
||||
from
|
||||
i := content_type_supported.lower
|
||||
n := content_type_supported.upper
|
||||
until
|
||||
i > n or Result /= Void
|
||||
loop
|
||||
if content_type_supported[i].same_string (s) then
|
||||
Result := s
|
||||
end
|
||||
i := i + 1
|
||||
end
|
||||
l_accept_lst.forth
|
||||
end
|
||||
l_accept_lst.forth
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ create
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (req: EWSGI_REQUEST; p: like path)
|
||||
make (req: WGI_REQUEST; p: like path)
|
||||
do
|
||||
request := req
|
||||
path := p
|
||||
|
||||
@@ -15,7 +15,7 @@ create
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (req: EWSGI_REQUEST; tpl: URI_TEMPLATE; tpl_res: URI_TEMPLATE_MATCH_RESULT; p: like path)
|
||||
make (req: WGI_REQUEST; tpl: URI_TEMPLATE; tpl_res: URI_TEMPLATE_MATCH_RESULT; p: like path)
|
||||
do
|
||||
request := req
|
||||
uri_template := tpl
|
||||
|
||||
@@ -23,11 +23,11 @@ feature -- Initialization
|
||||
|
||||
feature -- Access
|
||||
|
||||
action: PROCEDURE [ANY, TUPLE [ctx: REQUEST_HANDLER_CONTEXT; req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER]]
|
||||
action: PROCEDURE [ANY, TUPLE [ctx: REQUEST_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER]]
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute_application (ctx: REQUEST_HANDLER_CONTEXT; req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER)
|
||||
execute_application (ctx: REQUEST_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
do
|
||||
action.call ([ctx, req, res])
|
||||
end
|
||||
|
||||
@@ -21,7 +21,7 @@ feature -- Access
|
||||
|
||||
feature -- Status report
|
||||
|
||||
is_valid_context (req: EWSGI_REQUEST): BOOLEAN
|
||||
is_valid_context (req: WGI_REQUEST): BOOLEAN
|
||||
-- Is `req' valid context for current handler?
|
||||
do
|
||||
Result := request_method_name_supported (req.request_method)
|
||||
@@ -29,7 +29,7 @@ feature -- Status report
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (a_hdl_context: REQUEST_HANDLER_CONTEXT; req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER)
|
||||
execute (a_hdl_context: REQUEST_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
-- Execute request handler
|
||||
require
|
||||
is_valid_context: is_valid_context (req)
|
||||
@@ -52,7 +52,7 @@ feature -- Execution
|
||||
retry
|
||||
end
|
||||
|
||||
execute_method_not_allowed (a_hdl_context: REQUEST_HANDLER_CONTEXT; req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER)
|
||||
execute_method_not_allowed (a_hdl_context: REQUEST_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
local
|
||||
s: STRING
|
||||
lst: LIST [STRING]
|
||||
@@ -75,24 +75,24 @@ feature -- Execution
|
||||
res.write_header ({HTTP_STATUS_CODE}.method_not_allowed, <<["Allow", s]>>)
|
||||
end
|
||||
|
||||
execute_application (a_hdl_context: REQUEST_HANDLER_CONTEXT; req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER)
|
||||
execute_application (a_hdl_context: REQUEST_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
-- Execute request handler
|
||||
deferred
|
||||
end
|
||||
|
||||
pre_execute (req: EWSGI_REQUEST)
|
||||
pre_execute (req: WGI_REQUEST)
|
||||
-- Operation processed before `execute'
|
||||
do
|
||||
--| To be redefined if needed
|
||||
end
|
||||
|
||||
post_execute (req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER)
|
||||
post_execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
-- Operation processed after `execute'
|
||||
do
|
||||
--| To be redefined if needed
|
||||
end
|
||||
|
||||
rescue_execute (req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER)
|
||||
rescue_execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
-- Operation processed after a rescue
|
||||
do
|
||||
--| To be redefined if needed
|
||||
@@ -101,7 +101,7 @@ feature -- Execution
|
||||
|
||||
feature -- Execution: report
|
||||
|
||||
-- execution_information (req: EWSGI_REQUEST): detachable REQUEST_HANDLER_CONTEXT
|
||||
-- execution_information (req: WGI_REQUEST): detachable REQUEST_HANDLER_CONTEXT
|
||||
-- -- Execution information related to the request
|
||||
-- do
|
||||
-- if attached path_information (req, req.environment.path_info) as info then
|
||||
@@ -109,7 +109,7 @@ feature -- Execution: report
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- path_information (req: EWSGI_REQUEST; a_rq_path: STRING): detachable TUPLE [format: detachable STRING; arguments: detachable STRING]
|
||||
-- path_information (req: WGI_REQUEST; a_rq_path: STRING): detachable TUPLE [format: detachable STRING; arguments: detachable STRING]
|
||||
-- -- Information related to `a_path'
|
||||
-- local
|
||||
-- l_rq_path: STRING
|
||||
@@ -156,7 +156,7 @@ feature -- Execution: report
|
||||
-- end
|
||||
-- end
|
||||
|
||||
url (req: EWSGI_REQUEST; args: detachable STRING; abs: BOOLEAN): STRING
|
||||
url (req: WGI_REQUEST; args: detachable STRING; abs: BOOLEAN): STRING
|
||||
-- Associated url based on `path' and `args'
|
||||
-- if `abs' then return absolute url
|
||||
local
|
||||
|
||||
@@ -32,7 +32,7 @@ feature -- Registration
|
||||
|
||||
feature -- Execution
|
||||
|
||||
dispatch (req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER): detachable REQUEST_HANDLER
|
||||
dispatch (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER): detachable REQUEST_HANDLER
|
||||
-- Dispatch `req, res' to the associated handler
|
||||
-- And return this handler
|
||||
-- If Result is Void, this means no handler was found.
|
||||
@@ -60,7 +60,7 @@ feature -- Execution
|
||||
|
||||
feature {NONE} -- Access: Implementation
|
||||
|
||||
handler (req: EWSGI_REQUEST): detachable TUPLE [handler: REQUEST_HANDLER; context: REQUEST_HANDLER_CONTEXT]
|
||||
handler (req: WGI_REQUEST): detachable TUPLE [handler: REQUEST_HANDLER; context: REQUEST_HANDLER_CONTEXT]
|
||||
-- Handler whose map matched with `req'
|
||||
require
|
||||
req_valid: req /= Void and then req.path_info /= Void
|
||||
|
||||
@@ -35,14 +35,14 @@ feature -- Registration
|
||||
|
||||
feature {NONE} -- Access: Implementation
|
||||
|
||||
handler (req: EWSGI_REQUEST): detachable TUPLE [handler: REQUEST_HANDLER; context: REQUEST_HANDLER_CONTEXT]
|
||||
handler (req: WGI_REQUEST): detachable TUPLE [handler: REQUEST_HANDLER; context: REQUEST_HANDLER_CONTEXT]
|
||||
local
|
||||
h: detachable REQUEST_HANDLER
|
||||
ctx: detachable REQUEST_HANDLER_CONTEXT
|
||||
do
|
||||
h := handler_by_path (req.environment.path_info)
|
||||
h := handler_by_path (req.path_info)
|
||||
if h = Void then
|
||||
if attached smart_handler_by_path (req.environment.path_info) as info then
|
||||
if attached smart_handler_by_path (req.path_info) as info then
|
||||
h := info.handler
|
||||
ctx := handler_context (info.path, req)
|
||||
end
|
||||
@@ -59,13 +59,13 @@ feature {NONE} -- Access: Implementation
|
||||
end
|
||||
end
|
||||
|
||||
smart_handler (req: EWSGI_REQUEST): detachable TUPLE [path: STRING; handler: REQUEST_HANDLER]
|
||||
smart_handler (req: WGI_REQUEST): detachable TUPLE [path: STRING; handler: REQUEST_HANDLER]
|
||||
require
|
||||
req_valid: req /= Void and then req.environment.path_info /= Void
|
||||
req_valid: req /= Void and then req.path_info /= Void
|
||||
do
|
||||
Result := smart_handler_by_path (req.environment.path_info)
|
||||
Result := smart_handler_by_path (req.path_info)
|
||||
ensure
|
||||
req_path_info_unchanged: req.environment.path_info.same_string (old req.environment.path_info)
|
||||
req_path_info_unchanged: req.path_info.same_string (old req.path_info)
|
||||
end
|
||||
|
||||
handler_by_path (a_path: STRING): detachable REQUEST_HANDLER
|
||||
@@ -107,12 +107,12 @@ feature {NONE} -- Access: Implementation
|
||||
|
||||
feature -- Context factory
|
||||
|
||||
handler_context (p: detachable STRING; req: EWSGI_REQUEST): REQUEST_URI_HANDLER_CONTEXT
|
||||
handler_context (p: detachable STRING; req: WGI_REQUEST): REQUEST_URI_HANDLER_CONTEXT
|
||||
do
|
||||
if p /= Void then
|
||||
create Result.make (req, p)
|
||||
else
|
||||
create Result.make (req, req.environment.path_info)
|
||||
create Result.make (req, req.path_info)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ feature -- Registration
|
||||
|
||||
feature {NONE} -- Access: Implementation
|
||||
|
||||
handler (req: EWSGI_REQUEST): detachable TUPLE [handler: REQUEST_HANDLER; context: REQUEST_HANDLER_CONTEXT]
|
||||
handler (req: WGI_REQUEST): detachable TUPLE [handler: REQUEST_HANDLER; context: REQUEST_HANDLER_CONTEXT]
|
||||
local
|
||||
ctx: detachable REQUEST_URI_TEMPLATE_HANDLER_CONTEXT
|
||||
l_handlers: like handlers
|
||||
@@ -72,7 +72,7 @@ feature {NONE} -- Access: Implementation
|
||||
|
||||
feature -- Context factory
|
||||
|
||||
handler_context (p: detachable STRING; req: EWSGI_REQUEST; tpl: URI_TEMPLATE; tpl_res: URI_TEMPLATE_MATCH_RESULT): REQUEST_URI_TEMPLATE_HANDLER_CONTEXT
|
||||
handler_context (p: detachable STRING; req: WGI_REQUEST; tpl: URI_TEMPLATE; tpl_res: URI_TEMPLATE_MATCH_RESULT): REQUEST_URI_TEMPLATE_HANDLER_CONTEXT
|
||||
do
|
||||
if p /= Void then
|
||||
create Result.make (req, tpl, tpl_res, p)
|
||||
|
||||
@@ -9,9 +9,9 @@ class
|
||||
|
||||
feature -- Access
|
||||
|
||||
accepted_content_types (req: EWSGI_REQUEST): detachable ARRAYED_LIST [STRING]
|
||||
accepted_content_types (req: WGI_REQUEST): detachable ARRAYED_LIST [READABLE_STRING_8]
|
||||
local
|
||||
l_accept: detachable READABLE_STRING_8
|
||||
l_accept: detachable READABLE_STRING_32
|
||||
s: STRING_8
|
||||
q: READABLE_STRING_8
|
||||
p: INTEGER
|
||||
@@ -22,7 +22,7 @@ feature -- Access
|
||||
--TEST l_accept := "text/html,application/xhtml+xml;q=0.6,application/xml;q=0.2,text/plain;q=0.5,*/*;q=0.8"
|
||||
|
||||
if l_accept /= Void then
|
||||
lst := l_accept.split (',')
|
||||
lst := l_accept.as_string_8.split (',')
|
||||
create Result.make (lst.count)
|
||||
from
|
||||
lst.start
|
||||
@@ -41,7 +41,7 @@ feature -- Access
|
||||
|
||||
lst.forth
|
||||
end
|
||||
create qs.make (create {COMPARABLE_COMPARATOR [STRING]})
|
||||
create qs.make (create {COMPARABLE_COMPARATOR [READABLE_STRING_8]})
|
||||
qs.reverse_sort (Result)
|
||||
from
|
||||
Result.start
|
||||
|
||||
Reference in New Issue
Block a user