First integration of the new GW_ design more centralized on connector, and does not require specific feature on GW_APPLICATION depending on the connector.
So this is really more flexible this way, and much easier to write application supporting CGI, FCGI, Nino and so on .. as demonstrated in hello_world This is a first version, more will come later, mainly migrating from Eiffel Web Reloaded to this Eiffel Web Framework project.
This commit is contained in:
17
library/protocol/http/http-safe.ecf
Normal file
17
library/protocol/http/http-safe.ecf
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="http" uuid="F8BE3C55-88E8-4103-A936-B1E5CB1D330E" library_target="http">
|
||||
<target name="http">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all">
|
||||
<assertions precondition="true"/>
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<cluster name="src" location=".\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
18
library/protocol/http/http.ecf
Normal file
18
library/protocol/http/http.ecf
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="http" uuid="F8BE3C55-88E8-4103-A936-B1E5CB1D330E" library_target="http">
|
||||
<target name="http">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true">
|
||||
<assertions precondition="true"/>
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||
<cluster name="src" location=".\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
|
||||
97
library/protocol/http/src/http_constants.e
Normal file
97
library/protocol/http/src/http_constants.e
Normal file
@@ -0,0 +1,97 @@
|
||||
note
|
||||
description: "Summary description for {HTTP_CONSTANTS}."
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
HTTP_CONSTANTS
|
||||
|
||||
feature -- Ports
|
||||
|
||||
default_http_port: INTEGER = 80
|
||||
default_https_port: INTEGER = 443
|
||||
|
||||
feature -- Method
|
||||
|
||||
method_get: STRING = "GET"
|
||||
method_post: STRING = "POST"
|
||||
method_put: STRING = "PUT"
|
||||
method_delete: STRING = "DELETE"
|
||||
method_head: STRING = "HEAD"
|
||||
method_download: STRING = "DOWNLOAD"
|
||||
|
||||
feature -- Content type
|
||||
|
||||
octet_stream: STRING = "application/octet-stream"
|
||||
-- Octet stream content-type header
|
||||
multipart_form: STRING = "multipart/form-data"
|
||||
-- Starting chars of multipart form data content-type header
|
||||
form_encoded: STRING = "application/x-www-form-urlencoded"
|
||||
-- Starting chars of form url-encoded data content-type header
|
||||
xml_text: STRING = "text/xml"
|
||||
-- XML text content-type header
|
||||
html_text: STRING = "text/html"
|
||||
-- HTML text content-type header
|
||||
json_text: STRING = "text/json"
|
||||
-- JSON text content-type header
|
||||
json_app: STRING = "application/json"
|
||||
-- JSON application content-type header
|
||||
js_text: STRING = "text/javascript"
|
||||
-- Javascript text content-type header
|
||||
js_app: STRING = "application/javascript"
|
||||
-- JavaScript application content-type header
|
||||
plain_text: STRING = "text/plain"
|
||||
-- Plain text content-type header
|
||||
|
||||
feature -- Server
|
||||
|
||||
http_version_1_0: STRING = "HTTP/1.0"
|
||||
http_host_header: STRING = "Host"
|
||||
http_authorization_header: STRING = "Authorization: "
|
||||
http_end_of_header_line: STRING = "%R%N"
|
||||
http_end_of_command: STRING = "%R%N%R%N"
|
||||
http_content_length: STRING = "Content-Length: "
|
||||
http_content_type: STRING = "Content-Type: "
|
||||
http_content_location: STRING = "Content-Location: "
|
||||
http_content_disposition: STRING = "Content-Disposition: "
|
||||
http_path_translated: STRING = "Path-Translated: "
|
||||
http_agent: STRING = "User-agent: "
|
||||
http_from: STRING = "From: "
|
||||
|
||||
feature -- Server: header
|
||||
|
||||
header_host: STRING = "Host"
|
||||
header_authorization: STRING = "Authorization"
|
||||
header_content_length: STRING = "Content-Length"
|
||||
header_content_type: STRING = "Content-Type"
|
||||
header_content_location: STRING = "Content-Location"
|
||||
header_content_disposition: STRING = "Content-Disposition"
|
||||
header_cache_control: STRING = "Cache-Control"
|
||||
header_path_translated: STRING = "Path-Translated"
|
||||
header_agent: STRING = "User-Agent"
|
||||
header_referer: STRING = "Referer" -- Officially mispelled in std
|
||||
header_location: STRING = "Location"
|
||||
header_from: STRING = "From"
|
||||
header_status: STRING = "Status"
|
||||
header_multipart_tag_value_separator: CHARACTER = ';'
|
||||
|
||||
feature -- Misc
|
||||
|
||||
http_status_ok: STRING = "200 OK"
|
||||
|
||||
default_bufsize: INTEGER = 16384 --| 16K
|
||||
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
71
library/protocol/http/src/http_date_time_utilities.e
Normal file
71
library/protocol/http/src/http_date_time_utilities.e
Normal file
@@ -0,0 +1,71 @@
|
||||
note
|
||||
description: "Summary description for {HTTP_DATE_TIME_UTILITIES}."
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
HTTP_DATE_TIME_UTILITIES
|
||||
|
||||
feature -- Access
|
||||
|
||||
now_utc: DATE_TIME
|
||||
do
|
||||
create Result.make_now_utc
|
||||
end
|
||||
|
||||
epoch: DATE_TIME
|
||||
once ("THREAD")
|
||||
create Result.make_from_epoch (0)
|
||||
end
|
||||
|
||||
feature -- Unix time stamp
|
||||
|
||||
unix_time_stamp (dt: detachable DATE_TIME): INTEGER_64
|
||||
-- Unix time stamp from `dt' if attached or from epoch is detached
|
||||
local
|
||||
l_date_time: DATE_TIME
|
||||
do
|
||||
if dt /= Void then
|
||||
l_date_time := dt
|
||||
else
|
||||
l_date_time := now_utc
|
||||
end
|
||||
Result := l_date_time.definite_duration (epoch).seconds_count
|
||||
end
|
||||
|
||||
fine_unix_time_stamp (dt: detachable DATE_TIME): DOUBLE
|
||||
-- Fine unix time stamp from `dt' if attached or from epoch is detached
|
||||
local
|
||||
l_date_time: DATE_TIME
|
||||
do
|
||||
if dt /= Void then
|
||||
l_date_time := dt
|
||||
else
|
||||
l_date_time := now_utc
|
||||
end
|
||||
Result := l_date_time.definite_duration (epoch).fine_seconds_count
|
||||
end
|
||||
|
||||
feature -- Unix time stamp conversion
|
||||
|
||||
unix_time_stamp_to_date_time (i64: INTEGER_64): DATE_TIME
|
||||
-- Date time related to `i64'
|
||||
do
|
||||
create Result.make_from_epoch (i64.as_integer_32)
|
||||
ensure
|
||||
same_unix_time_stamp: unix_time_stamp (Result) = i64
|
||||
end
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
106
library/protocol/http/src/http_status_code.e
Normal file
106
library/protocol/http/src/http_status_code.e
Normal file
@@ -0,0 +1,106 @@
|
||||
note
|
||||
description: "[
|
||||
Status code constants pertaining to the HTTP protocol
|
||||
See http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
|
||||
]"
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
HTTP_STATUS_CODE
|
||||
|
||||
feature -- 1xx : Informational
|
||||
|
||||
continue: INTEGER = 100
|
||||
switching_protocols: INTEGER = 101
|
||||
processing: INTEGER = 102 -- WebDAV RFC 2518
|
||||
ie7_request_uri_too_long: INTEGER = 122 -- non standard, IE7 only
|
||||
|
||||
feature -- 2xx : Success
|
||||
|
||||
ok: INTEGER = 200
|
||||
created: INTEGER = 201
|
||||
accepted: INTEGER = 202
|
||||
nonauthoritative_info: INTEGER = 203
|
||||
no_content: INTEGER = 204
|
||||
reset_content: INTEGER = 205
|
||||
partial_content: INTEGER = 206
|
||||
multistatus: INTEGER = 207 -- WebDAV RFC 4918
|
||||
im_used: INTEGER = 226 -- RFC 4918
|
||||
|
||||
feature -- 3xx : Redirection
|
||||
|
||||
multiple_choices: INTEGER = 300
|
||||
moved_permanently: INTEGER = 301
|
||||
found: INTEGER = 302
|
||||
see_other: INTEGER = 303
|
||||
not_modified: INTEGER = 304
|
||||
use_proxy: INTEGER = 305
|
||||
switch_proxy: INTEGER = 306
|
||||
temp_redirect: INTEGER = 307
|
||||
|
||||
feature -- 4xx : Client Error
|
||||
|
||||
bad_request: INTEGER = 400
|
||||
unauthorized: INTEGER = 401
|
||||
payment_required: INTEGER = 402
|
||||
forbidden: INTEGER = 403
|
||||
not_found: INTEGER = 404
|
||||
method_not_allowed: INTEGER = 405
|
||||
not_acceptable: INTEGER = 406
|
||||
proxy_auth_required: INTEGER = 407
|
||||
request_timeout: INTEGER = 408
|
||||
conflict: INTEGER = 409
|
||||
gone: INTEGER = 410
|
||||
length_required: INTEGER = 411
|
||||
precondition_failed: INTEGER = 412
|
||||
request_entity_too_large: INTEGER = 413
|
||||
request_uri_too_long: INTEGER = 414
|
||||
unsupported_media_type: INTEGER = 415
|
||||
request_range_not_satisfiable: INTEGER = 416
|
||||
expectation_failed: INTEGER = 417
|
||||
teapot: INTEGER = 418
|
||||
|
||||
feature -- 4xx : Client Error : WebDAV errors
|
||||
|
||||
too_many_connections: INTEGER = 421
|
||||
unprocessable_entity: INTEGER = 422
|
||||
locked: INTEGER = 423
|
||||
failed_dependency: INTEGER = 424
|
||||
unordered_collection: INTEGER = 425
|
||||
|
||||
upgrade_required: INTEGER = 426
|
||||
no_response: INTEGER = 444
|
||||
retry_with: INTEGER = 449
|
||||
blocked_parental: INTEGER = 450
|
||||
client_closed_request: INTEGER = 499
|
||||
|
||||
feature -- 5xx : Server Error
|
||||
|
||||
internal_server_error: INTEGER = 500
|
||||
not_implemented: INTEGER = 501
|
||||
bad_gateway: INTEGER = 502
|
||||
service_unavailable: INTEGER = 503
|
||||
gateway_timeout: INTEGER = 504
|
||||
http_version_not_supported: INTEGER = 505
|
||||
variant_also_negotiates: INTEGER = 506
|
||||
insufficient_storage: INTEGER = 507 -- WebDAV RFC 4918
|
||||
|
||||
bandwidth_limit_exceeded: INTEGER = 509
|
||||
not_extended: INTEGER = 510
|
||||
|
||||
user_access_denied: INTEGER = 530
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
160
library/protocol/http/src/http_status_code_messages.e
Normal file
160
library/protocol/http/src/http_status_code_messages.e
Normal file
@@ -0,0 +1,160 @@
|
||||
note
|
||||
description: "[
|
||||
Status code constants pertaining to the HTTP protocol
|
||||
See http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
|
||||
]"
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
HTTP_STATUS_CODE_MESSAGES
|
||||
|
||||
inherit
|
||||
HTTP_STATUS_CODE
|
||||
|
||||
feature -- Status report
|
||||
|
||||
is_valid_http_status_code (v: INTEGER): BOOLEAN
|
||||
-- Is the given value a valid http status code?
|
||||
do
|
||||
Result := v >= continue and v <= user_access_denied
|
||||
end
|
||||
|
||||
feature -- Status messages
|
||||
|
||||
http_status_code_message (a_code: INTEGER): detachable STRING
|
||||
-- Header message related to HTTP status code `a_code'
|
||||
do
|
||||
inspect a_code
|
||||
when continue then
|
||||
Result := "Continue"
|
||||
when switching_protocols then
|
||||
Result := "Switching Protocols"
|
||||
when processing then
|
||||
Result := "Processing"
|
||||
when ok then
|
||||
Result := "OK"
|
||||
when created then
|
||||
Result := "Created"
|
||||
when accepted then
|
||||
Result := "Accepted"
|
||||
when nonauthoritative_info then
|
||||
Result := "Non-Authoritative Information"
|
||||
when no_content then
|
||||
Result := "No Content"
|
||||
when reset_content then
|
||||
Result := "Reset Content"
|
||||
when partial_content then
|
||||
Result := "Partial Content"
|
||||
when multistatus then
|
||||
Result := "Multi-Status"
|
||||
when multiple_choices then
|
||||
Result := "Multiple Choices"
|
||||
when moved_permanently then
|
||||
Result := "Moved Permanently"
|
||||
when found then
|
||||
Result := "Found"
|
||||
when see_other then
|
||||
Result := "See Other"
|
||||
when not_modified then
|
||||
Result := "Not Modified"
|
||||
when use_proxy then
|
||||
Result := "Use Proxy"
|
||||
when switch_proxy then
|
||||
Result := "Switch Proxy"
|
||||
when temp_redirect then
|
||||
Result := "Temporary Redirect"
|
||||
when bad_request then
|
||||
Result := "Bad Request"
|
||||
when unauthorized then
|
||||
Result := "Unauthorized"
|
||||
when payment_required then
|
||||
Result := "Payment Required"
|
||||
when forbidden then
|
||||
Result := "Forbidden"
|
||||
when not_found then
|
||||
Result := "Not Found"
|
||||
when method_not_allowed then
|
||||
Result := "Method Not Allowed"
|
||||
when not_acceptable then
|
||||
Result := "Not Acceptable"
|
||||
when proxy_auth_required then
|
||||
Result := "Proxy Authentication Required"
|
||||
when request_timeout then
|
||||
Result := "Request Timeout"
|
||||
when conflict then
|
||||
Result := "Conflict"
|
||||
when gone then
|
||||
Result := "Gone"
|
||||
when length_required then
|
||||
Result := "Length Required"
|
||||
when precondition_failed then
|
||||
Result := "Precondition Failed"
|
||||
when request_entity_too_large then
|
||||
Result := "Request Entity Too Large"
|
||||
when request_uri_too_long then
|
||||
Result := "Request-URI Too Long"
|
||||
when unsupported_media_type then
|
||||
Result := "Unsupported Media Type"
|
||||
when request_range_not_satisfiable then
|
||||
Result := "Requested Range Not Satisfiable"
|
||||
when expectation_failed then
|
||||
Result := "Expectation Failed"
|
||||
when teapot then
|
||||
Result := "I'm a teapot"
|
||||
when too_many_connections then
|
||||
Result := "There are too many connections from your internet address"
|
||||
when unprocessable_entity then
|
||||
Result := "Unprocessable Entity"
|
||||
when locked then
|
||||
Result := "Locked"
|
||||
when failed_dependency then
|
||||
Result := "Failed Dependency"
|
||||
when unordered_collection then
|
||||
Result := "Unordered Collection"
|
||||
when upgrade_required then
|
||||
Result := "Upgrade Required"
|
||||
when retry_with then
|
||||
Result := "Retry With"
|
||||
when blocked_parental then
|
||||
Result := "Blocked by Windows Parental Controls"
|
||||
when internal_server_error then
|
||||
Result := "Internal Server Error"
|
||||
when not_implemented then
|
||||
Result := "Not Implemented"
|
||||
when bad_gateway then
|
||||
Result := "Bad Gateway"
|
||||
when service_unavailable then
|
||||
Result := "Service Unavailable"
|
||||
when gateway_timeout then
|
||||
Result := "Gateway Timeout"
|
||||
when http_version_not_supported then
|
||||
Result := "HTTP Version Not Supported"
|
||||
when variant_also_negotiates then
|
||||
Result := "Variant Also Negotiates"
|
||||
when insufficient_storage then
|
||||
Result := "Insufficient Storage"
|
||||
when bandwidth_limit_exceeded then
|
||||
Result := "Bandwidth Limit Exceeded"
|
||||
when not_extended then
|
||||
Result := "Not Extended"
|
||||
when user_access_denied then
|
||||
Result := "User access denied"
|
||||
else
|
||||
Result := Void
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
Reference in New Issue
Block a user