Changed prefix class name from EWSGI_ to WGI_
changes in interface for REQUEST and RESPONSE
This commit is contained in:
@@ -14,14 +14,14 @@ Note the following is work in progress, and reflect a specification proposal, ra
|
|||||||
For now, the specification from EWF is done in Eiffel interface
|
For now, the specification from EWF is done in Eiffel interface
|
||||||
please see: https://github.com/Eiffel-World/Eiffel-Web-Framework/tree/master/library/server/ewsgi/specification
|
please see: https://github.com/Eiffel-World/Eiffel-Web-Framework/tree/master/library/server/ewsgi/specification
|
||||||
|
|
||||||
EWSGI_APPLICATION
|
WGI_APPLICATION
|
||||||
|
|
||||||
deferred class
|
deferred class
|
||||||
EWSGI_APPLICATION
|
WGI_APPLICATION
|
||||||
|
|
||||||
feature {NONE} -- Execution
|
feature {NONE} -- Execution
|
||||||
|
|
||||||
execute (req: EWSGI_REQUEST; res: EWSGI_RESPONSE_BUFFER)
|
execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||||
-- Execute the request
|
-- Execute the request
|
||||||
-- See `req.input' for input stream
|
-- See `req.input' for input stream
|
||||||
-- `req.environment' for the Gateway environment
|
-- `req.environment' for the Gateway environment
|
||||||
@@ -36,13 +36,13 @@ EWSGI_APPLICATION
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
EWSGI_REQUEST
|
WGI_REQUEST
|
||||||
|
|
||||||
deferred class
|
deferred class
|
||||||
EWSGI_REQUEST
|
WGI_REQUEST
|
||||||
feature -- Access: Input
|
feature -- Access: Input
|
||||||
|
|
||||||
input: EWSGI_INPUT_STREAM
|
input: WGI_INPUT_STREAM
|
||||||
-- Server input channel
|
-- Server input channel
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
@@ -54,42 +54,27 @@ EWSGI_REQUEST
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access: environment variables
|
feature -- Access: CGI meta variables
|
||||||
|
|
||||||
environment: EWSGI_ENVIRONMENT
|
meta_variable (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
||||||
-- Environment variables
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
environment_variable (a_name: STRING_8): detachable 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
|
||||||
|
|
||||||
feature -- Access: execution variables
|
meta_variables: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_GENERAL]
|
||||||
|
|
||||||
execution_variables: EWSGI_VARIABLES [STRING_32]
|
|
||||||
-- Execution variables set by the application
|
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
execution_variable (a_name: STRING_8): detachable STRING_32
|
feature -- Query string Parameters
|
||||||
-- Execution variable related to `a_name'
|
|
||||||
require
|
|
||||||
a_name_valid: a_name /= Void and then not a_name.is_empty
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- URL Parameters
|
query_parameters: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_GENERAL]
|
||||||
|
|
||||||
parameters: EWSGI_VARIABLES [STRING_32]
|
|
||||||
-- Variables extracted from QUERY_STRING
|
-- Variables extracted from QUERY_STRING
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
parameter (a_name: STRING_8): detachable STRING_32
|
query_parameter (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
||||||
-- Parameter for name `n'.
|
-- Parameter for name `n'.
|
||||||
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
|
||||||
@@ -98,52 +83,53 @@ EWSGI_REQUEST
|
|||||||
|
|
||||||
feature -- Form fields and related
|
feature -- Form fields and related
|
||||||
|
|
||||||
form_fields: EWSGI_VARIABLES [STRING_32]
|
form_data_parameters: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_GENERAL]
|
||||||
-- Variables sent by POST request
|
-- Variables sent by POST request
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
form_field (a_name: STRING_8): detachable STRING_32
|
form_data_parameter (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
||||||
-- Field for name `a_name'.
|
-- Field for name `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
|
||||||
|
|
||||||
uploaded_files: HASH_TABLE [EWSGI_UPLOADED_FILE_DATA, STRING_8]
|
uploaded_files: HASH_TABLE [WGI_UPLOADED_FILE_DATA, READABLE_STRING_GENERAL]
|
||||||
-- Table of uploaded files information
|
-- Table of uploaded files information
|
||||||
|
--| name: original path from the user
|
||||||
|
--| type: content type
|
||||||
|
--| tmp_name: path to temp file that resides on server
|
||||||
|
--| tmp_base_name: basename of `tmp_name'
|
||||||
|
--| error: if /= 0 , there was an error : TODO ...
|
||||||
|
--| size: size of the file given by the http request
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Cookies
|
feature -- Cookies
|
||||||
|
|
||||||
cookies_variables: HASH_TABLE [STRING_8, STRING_8]
|
cookies: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_GENERAL]
|
||||||
-- Expanded cookies variable
|
-- Expanded cookies variable
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
cookies_variable (a_name: STRING_8): detachable STRING_8
|
cookie (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
||||||
-- Field for name `a_name'.
|
-- Field for name `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
|
||||||
|
|
||||||
cookies: HASH_TABLE [EWSGI_COOKIE, STRING_8]
|
|
||||||
-- Cookies Information
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Access: global variable
|
feature -- Access: global variable
|
||||||
|
|
||||||
variables: HASH_TABLE [STRING_32, STRING_32]
|
parameters: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_GENERAL]
|
||||||
-- Table containing all the various variables
|
-- Table containing all the various variables
|
||||||
-- Warning: this is computed each time, if you change the content of other containers
|
-- Warning: this is computed each time, if you change the content of other containers
|
||||||
-- this won't update this Result's content, unless you query it again
|
-- this won't update this Result's content, unless you query it again
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
variable (a_name: STRING_8): detachable STRING_32
|
parameter (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
||||||
-- Variable named `a_name' from any of the variables container
|
-- Variable named `a_name' from any of the variables container
|
||||||
-- and following a specific order
|
-- and following a specific order
|
||||||
-- execution, environment, get, post, cookies
|
-- execution, environment, get, post, cookies
|
||||||
@@ -175,12 +161,12 @@ EWSGI_REQUEST
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
EWSGI_RESPONSE_BUFFER
|
WGI_RESPONSE_BUFFER
|
||||||
|
|
||||||
deferred class
|
deferred class
|
||||||
EWSGI_RESPONSE_BUFFER
|
WGI_RESPONSE_BUFFER
|
||||||
|
|
||||||
feature {EWSGI_APPLICATION} -- Commit
|
feature {WGI_APPLICATION} -- Commit
|
||||||
|
|
||||||
commit
|
commit
|
||||||
-- Commit the current response
|
-- Commit the current response
|
||||||
@@ -208,9 +194,9 @@ EWSGI_RESPONSE_BUFFER
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE} -- Core output operation
|
feature {WGI_RESPONSE_BUFFER} -- Core output operation
|
||||||
|
|
||||||
write (s: STRING_8)
|
write (s: STRING)
|
||||||
-- Send the string `s'
|
-- Send the string `s'
|
||||||
-- this can be used for header and body
|
-- this can be used for header and body
|
||||||
deferred
|
deferred
|
||||||
@@ -223,7 +209,7 @@ EWSGI_RESPONSE_BUFFER
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
set_status_code (a_code: INTEGER_32)
|
set_status_code (a_code: INTEGER)
|
||||||
-- Set response status code
|
-- Set response status code
|
||||||
-- Should be done before sending any data back to the client
|
-- Should be done before sending any data back to the client
|
||||||
require
|
require
|
||||||
@@ -235,42 +221,25 @@ EWSGI_RESPONSE_BUFFER
|
|||||||
status_set: status_is_set
|
status_set: status_is_set
|
||||||
end
|
end
|
||||||
|
|
||||||
status_code: INTEGER_32
|
status_code: INTEGER
|
||||||
-- Response status
|
-- Response status
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Output operation
|
|
||||||
|
|
||||||
flush
|
|
||||||
-- Flush if it makes sense
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
write_string (s: STRING_8)
|
|
||||||
-- Send the string `s'
|
|
||||||
require
|
|
||||||
message_writable: message_writable
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
write_substring (s: STRING_8; a_begin_index, a_end_index: INTEGER_32)
|
|
||||||
-- Send the substring `s[a_begin_index:a_end_index]'
|
|
||||||
require
|
|
||||||
message_writable: message_writable
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
write_file_content (fn: STRING_8)
|
|
||||||
-- Send the content of file `fn'
|
|
||||||
require
|
|
||||||
message_writable: message_writable
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Header output operation
|
feature -- Header output operation
|
||||||
|
|
||||||
write_header (a_status_code: INTEGER_32; a_headers: detachable ARRAY [TUPLE [key: STRING_8; value: STRING_8]])
|
write_headers_string (a_headers: STRING)
|
||||||
|
require
|
||||||
|
status_set: status_is_set
|
||||||
|
header_not_committed: not header_committed
|
||||||
|
deferred
|
||||||
|
ensure
|
||||||
|
status_set: status_is_set
|
||||||
|
header_committed: header_committed
|
||||||
|
message_writable: message_writable
|
||||||
|
end
|
||||||
|
|
||||||
|
write_header (a_status_code: INTEGER; a_headers: detachable ARRAY [TUPLE [key: STRING; value: STRING]])
|
||||||
-- Send headers with status `a_status', and headers from `a_headers'
|
-- Send headers with status `a_status', and headers from `a_headers'
|
||||||
require
|
require
|
||||||
status_not_set: not status_is_set
|
status_not_set: not status_is_set
|
||||||
@@ -279,12 +248,40 @@ EWSGI_RESPONSE_BUFFER
|
|||||||
ensure
|
ensure
|
||||||
header_committed: header_committed
|
header_committed: header_committed
|
||||||
status_set: status_is_set
|
status_set: status_is_set
|
||||||
|
message_writable: message_writable
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Output operation
|
||||||
|
|
||||||
|
write_string (s: STRING)
|
||||||
|
-- Send the string `s'
|
||||||
|
require
|
||||||
|
message_writable: message_writable
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
|
write_substring (s: STRING; a_begin_index, a_end_index: INTEGER)
|
||||||
|
-- Send the substring `s[a_begin_index:a_end_index]'
|
||||||
|
require
|
||||||
|
message_writable: message_writable
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
|
write_file_content (fn: STRING)
|
||||||
|
-- Send the content of file `fn'
|
||||||
|
require
|
||||||
|
message_writable: message_writable
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
|
flush
|
||||||
|
-- Flush if it makes sense
|
||||||
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Proof-of-concept and reference implementation
|
## Proof-of-concept and reference implementation
|
||||||
|
|
||||||
# Specification overview
|
# Specification overview
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
## libraries currently part of the Eiffel Web Framework ##
|
## libraries currently part of the Eiffel Web Framework ##
|
||||||
* [[Library-EWSGI]]: Eiffel Web Server Gateway Interface (prefix GW_ for **G**ate**W**ay)
|
* [[Library-EWSGI]]: Eiffel Web Server Gateway Interface (prefix WGI_ for **W**eb**G**ateway**I**nterface)
|
||||||
* [[Library-libFCGI]]: Eiffel wrapper of libfcgi SDK (http://www.fastcgi.com/devkit/libfcgi/)
|
* [[Library-libFCGI]]: Eiffel wrapper of libfcgi SDK (http://www.fastcgi.com/devkit/libfcgi/)
|
||||||
* [[Library-encoder]]: simple encoder for base64, url-encode, xml entities
|
* [[Library-encoder]]: simple encoder for base64, url-encode, xml entities
|
||||||
* [[Library-error]]: simple framework to handle error in EWSGI and related
|
* [[Library-error]]: simple framework to handle error in EWSGI and related
|
||||||
|
|||||||
Reference in New Issue
Block a user