Added an implementation folder in ewsgi_spec, mainly to provide default implementation just to save the developer of connector some time.

changed structured
This commit is contained in:
Jocelyn Fiat
2011-07-27 17:34:53 +02:00
parent e9b05ffc0b
commit 73284575d4
31 changed files with 190 additions and 58 deletions

View File

@@ -10,7 +10,8 @@
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all">
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="ewsgi" location="..\..\ewsgi-safe.ecf" readonly="false"/>
<library name="ewsgi_spec" location="..\..\ewsgi_specification-safe.ecf" readonly="false"/>
<library name="http" location="..\..\..\..\protocol\http\http-safe.ecf"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
</system>

View File

@@ -10,7 +10,8 @@
<option warning="true" full_class_checking="true">
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="ewsgi" location="..\ewsgi.ecf" readonly="false"/>
<library name="ewsgi_spec" location="..\..\ewsgi_specification.ecf" readonly="false"/>
<library name="http" location="..\..\..\..\protocol\http\http.ecf"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
</system>

View File

@@ -8,7 +8,7 @@ class
GW_CGI_CONNECTOR
inherit
GW_CONNECTOR
EWSGI_CONNECTOR
create
make
@@ -17,7 +17,7 @@ feature -- Execution
launch
local
env: GW_ENVIRONMENT_VARIABLES
env: EWSGI_ENVIRONMENT_VARIABLES
do
create env.make_with_variables ((create {EXECUTION_ENVIRONMENT}).starting_environment_variables)
application.process (env, create {GW_CGI_INPUT_STREAM}.make, create {GW_CGI_OUTPUT_STREAM}.make)

View File

@@ -9,7 +9,7 @@ class
GW_CGI_INPUT_STREAM
inherit
GW_INPUT_STREAM
EWSGI_INPUT_STREAM
CONSOLE
rename

View File

@@ -9,7 +9,7 @@ class
GW_CGI_OUTPUT_STREAM
inherit
GW_OUTPUT_STREAM
EWSGI_OUTPUT_STREAM
undefine
flush
end
@@ -19,6 +19,11 @@ inherit
make as console_make
end
HTTP_STATUS_CODE_MESSAGES
export
{NONE} all
end
create
make
@@ -29,6 +34,26 @@ feature {NONE} -- Initialization
make_open_stdout ("stdout")
end
feature -- Status writing
put_status_line (a_code: INTEGER)
-- Put status code line for `a_code'
--| Note this is a default implementation, and could be redefined
--| for instance in relation to NPH CGI script
local
s: STRING
do
create s.make (16)
s.append ({HTTP_CONSTANTS}.http_version_1_1)
s.append_character (' ')
s.append_integer (a_code)
if attached http_status_code_message (a_code) as l_status_message then
s.append_character (' ')
s.append_string (l_status_message)
end
put_header_line (s)
end
note
copyright: "2011-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"

View File

@@ -10,8 +10,9 @@
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all">
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="ewsgi" location="..\..\ewsgi-safe.ecf" readonly="false"/>
<library name="ewsgi_spec" location="..\..\ewsgi_specification-safe.ecf" readonly="false"/>
<library name="libfcgi" location="..\..\..\libfcgi\libfcgi-safe.ecf" />
<library name="http" location="..\..\..\..\protocol\http\http-safe.ecf"/>
<cluster name="src" location=".\" recursive="true"/>
</target>
</system>

View File

@@ -10,8 +10,9 @@
<option warning="true" full_class_checking="true">
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="ewsgi" location="..\..\ewsgi.ecf" readonly="false"/>
<library name="libfcgi" location="..\..\libfcgi\libfcgi.ecf" />
<library name="ewsgi_spec" location="..\..\ewsgi_specification.ecf" readonly="false"/>
<library name="libfcgi" location="..\..\..\libfcgi\libfcgi.ecf" />
<library name="http" location="..\..\..\..\protocol\http\http.ecf"/>
<cluster name="src" location=".\" recursive="true"/>
</target>
</system>

View File

@@ -9,7 +9,7 @@ class
GW_LIBFCGI_CONNECTOR
inherit
GW_CONNECTOR
EWSGI_CONNECTOR
redefine
initialize
end
@@ -46,7 +46,7 @@ feature -- Execution
process_fcgi_request (vars: HASH_TABLE [STRING, STRING]; a_input: like input; a_output: like output)
local
gw_env: GW_ENVIRONMENT_VARIABLES
gw_env: EWSGI_ENVIRONMENT_VARIABLES
do
create gw_env.make_with_variables (vars)
application.process (gw_env, a_input, a_output)
@@ -54,10 +54,10 @@ feature -- Execution
feature -- Input/Output
input: GW_INPUT_STREAM
input: EWSGI_INPUT_STREAM
-- Input from client (from httpd server via FCGI)
output: GW_OUTPUT_STREAM
output: EWSGI_OUTPUT_STREAM
-- Output to client (via httpd server/fcgi)
feature {NONE} -- Implementation

View File

@@ -9,7 +9,7 @@ class
GW_LIBFCGI_INPUT_STREAM
inherit
GW_INPUT_STREAM
EWSGI_INPUT_STREAM
STRING_HANDLER

View File

@@ -9,7 +9,12 @@ class
GW_LIBFCGI_OUTPUT_STREAM
inherit
GW_OUTPUT_STREAM
EWSGI_OUTPUT_STREAM
HTTP_STATUS_CODE_MESSAGES
export
{NONE} all
end
create
make
@@ -23,6 +28,26 @@ feature {NONE} -- Initialization
fcgi := a_fcgi
end
feature -- Status writing
put_status_line (a_code: INTEGER)
-- Put status code line for `a_code'
--| Note this is a default implementation, and could be redefined
--| for instance in relation to NPH CGI script
local
s: STRING
do
create s.make (16)
s.append ({HTTP_CONSTANTS}.http_version_1_1)
s.append_character (' ')
s.append_integer (a_code)
if attached http_status_code_message (a_code) as l_status_message then
s.append_character (' ')
s.append_string (l_status_message)
end
put_header_line (s)
end
feature -- Basic operation
put_string (s: STRING)

View File

@@ -10,8 +10,12 @@
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all">
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="ewsgi_spec" location="..\..\ewsgi_specification-safe.ecf" readonly="false"/>
<library name="ewsgi" location="..\..\ewsgi-safe.ecf" readonly="false"/>
<library name="nino" location="..\..\..\..\..\ext\server\nino\nino-safe.ecf" readonly="false"/>
<library name="http" location="..\..\..\..\protocol\http\http-safe.ecf"/>
<library name="nino" location="..\..\..\..\..\ext\server\nino\nino-safe.ecf" readonly="false">
<renaming old_name="HTTP_CONSTANTS" new_name="NINO_HTTP_CONSTANTS"/>
</library>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
</system>

View File

@@ -10,8 +10,12 @@
<option warning="true" full_class_checking="true">
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="ewsgi" location="..\ewsgi.ecf" readonly="false"/>
<library name="nino" location="..\..\..\..\..\ext\server\nino\nino.ecf" readonly="false"/>
<library name="ewsgi_spec" location="..\..\ewsgi_specification.ecf" readonly="false"/>
<library name="ewsgi" location="..\..\ewsgi.ecf" readonly="false"/>
<library name="http" location="..\..\..\..\protocol\http\http.ecf"/>
<library name="nino" location="..\..\..\..\..\ext\server\nino\nino.ecf" readonly="false">
<renaming old_name="HTTP_CONSTANTS" new_name="NINO_HTTP_CONSTANTS"/>
</library>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
</system>

View File

@@ -8,7 +8,7 @@ class
GW_NINO_CONNECTOR
inherit
GW_CONNECTOR
EWSGI_CONNECTOR
redefine
initialize
end
@@ -62,7 +62,7 @@ feature -- Server
local
l_http_handler : HTTP_HANDLER
do
create {GW_NINO_HANDLER} l_http_handler.make_with_callback (server, "GW_NINO_HANDLER", Current)
create {GW_NINO_HANDLER} l_http_handler.make_with_callback (server, "NINO_HANDLER", Current)
debug ("nino")
if attached base as l_base then
print ("Base=" + l_base + "%N")
@@ -73,7 +73,7 @@ feature -- Server
process_request (env: HASH_TABLE [STRING, STRING]; a_headers_text: STRING; a_input: HTTP_INPUT_STREAM; a_output: HTTP_OUTPUT_STREAM)
local
gw_env: GW_ENVIRONMENT_VARIABLES
gw_env: EWSGI_ENVIRONMENT_VARIABLES
do
create gw_env.make_with_variables (env)
gw_env.set_variable ("RAW_HEADER_DATA", a_headers_text)

View File

@@ -9,7 +9,7 @@ class
GW_NINO_INPUT_STREAM
inherit
GW_INPUT_STREAM
EWSGI_INPUT_STREAM
create
make
@@ -22,7 +22,7 @@ feature {NONE} -- Initialization
set_nino_input (a_nino_input)
end
feature {GW_NINO_CONNECTOR, GW_APPLICATION} -- Nino
feature {GW_NINO_CONNECTOR, EWSGI_APPLICATION} -- Nino
set_nino_input (i: like nino_input)
do

View File

@@ -9,7 +9,12 @@ class
GW_NINO_OUTPUT_STREAM
inherit
GW_OUTPUT_STREAM
EWSGI_OUTPUT_STREAM
HTTP_STATUS_CODE_MESSAGES
export
{NONE} all
end
create
make
@@ -21,7 +26,7 @@ feature {NONE} -- Initialization
set_nino_output (a_nino_output)
end
feature {GW_NINO_CONNECTOR, GW_APPLICATION} -- Nino
feature {GW_NINO_CONNECTOR, EWSGI_APPLICATION} -- Nino
set_nino_output (o: like nino_output)
do
@@ -30,6 +35,26 @@ feature {GW_NINO_CONNECTOR, GW_APPLICATION} -- Nino
nino_output: HTTP_OUTPUT_STREAM
feature -- Status writing
put_status_line (a_code: INTEGER)
-- Put status code line for `a_code'
--| Note this is a default implementation, and could be redefined
--| for instance in relation to NPH CGI script
local
s: STRING
do
create s.make (16)
s.append ({HTTP_CONSTANTS}.http_version_1_1)
s.append_character (' ')
s.append_integer (a_code)
if attached http_status_code_message (a_code) as l_status_message then
s.append_character (' ')
s.append_string (l_status_message)
end
put_header_line (s)
end
feature -- Basic operation
put_string (s: STRING_8)