Completed first pass for HTTP 1.1 conformace contracts
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-9-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-9-0 http://www.eiffel.com/developers/xml/configuration-1-9-0.xsd" name="restbucks" uuid="7C9887BD-4AE4-47F2-A0AA-4BBB6736D433">
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-10-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-10-0 http://www.eiffel.com/developers/xml/configuration-1-10-0.xsd" name="restbucks" uuid="7C9887BD-4AE4-47F2-A0AA-4BBB6736D433">
|
||||||
<target name="restbucks">
|
<target name="restbucks">
|
||||||
<root class="RESTBUCKS_SERVER" feature="make"/>
|
<root class="RESTBUCKS_SERVER" feature="make"/>
|
||||||
<file_rule>
|
<file_rule>
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
</file_rule>
|
</file_rule>
|
||||||
<option debug="true" warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="provisional">
|
<option debug="true" warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="provisional">
|
||||||
<debug name="nino" enabled="true"/>
|
<debug name="nino" enabled="true"/>
|
||||||
<assertions precondition="true" postcondition="true" invariant="true" supplier_precondition="true"/>
|
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||||
</option>
|
</option>
|
||||||
<setting name="concurrency" value="thread"/>
|
<setting name="concurrency" value="thread"/>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
@@ -21,9 +21,9 @@
|
|||||||
<library name="default_nino" location="..\..\library\server\wsf\default\nino-safe.ecf" readonly="false"/>
|
<library name="default_nino" location="..\..\library\server\wsf\default\nino-safe.ecf" readonly="false"/>
|
||||||
<library name="eel" location="..\..\contrib\ise_library\text\encryption\eel\eel-safe.ecf" readonly="false"/>
|
<library name="eel" location="..\..\contrib\ise_library\text\encryption\eel\eel-safe.ecf" readonly="false"/>
|
||||||
<library name="encoder" location="..\..\library\text\encoder\encoder-safe.ecf" readonly="false"/>
|
<library name="encoder" location="..\..\library\text\encoder\encoder-safe.ecf" readonly="false"/>
|
||||||
<library name="http" location="../../library/network/protocol/http/http-safe.ecf" readonly="false"/>
|
<library name="http" location="..\..\library\network\protocol\http\http-safe.ecf" readonly="false"/>
|
||||||
<library name="json" location="..\..\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
<library name="json" location="..\..\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
||||||
<library name="uri_template" location="../../library/text/parser/uri_template/uri_template-safe.ecf" readonly="false"/>
|
<library name="uri_template" location="..\..\library\text\parser\uri_template\uri_template-safe.ecf" readonly="false"/>
|
||||||
<library name="wsf" location="..\..\library\server\wsf\wsf-safe.ecf" readonly="false"/>
|
<library name="wsf" location="..\..\library\server\wsf\wsf-safe.ecf" readonly="false"/>
|
||||||
<library name="wsf_extension" location="..\..\library\server\wsf\wsf_extension-safe.ecf" readonly="false"/>
|
<library name="wsf_extension" location="..\..\library\server\wsf\wsf_extension-safe.ecf" readonly="false"/>
|
||||||
<cluster name="src" location="src\" recursive="true"/>
|
<cluster name="src" location="src\" recursive="true"/>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ feature -- Method
|
|||||||
ensure
|
ensure
|
||||||
valid_response_for_http_1_0: is_1_0 (a_req.server_protocol) implies
|
valid_response_for_http_1_0: is_1_0 (a_req.server_protocol) implies
|
||||||
valid_response_for_http_1_0 (a_res.status_code)
|
valid_response_for_http_1_0 (a_res.status_code)
|
||||||
empty_body_for_no_content_response: is_no_content_response(a_res.status_code) implies a_res.transfered_content_length = 0 -- Is that the right measure?
|
empty_body_for_no_content_response: is_no_content_response (a_res.status_code) implies is_empty_content (a_res)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Contract support
|
feature -- Contract support
|
||||||
@@ -60,5 +60,13 @@ feature -- Contract support
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
is_empty_content (a_res: WSF_RESPONSE): BOOLEAN
|
||||||
|
-- Does `a_res' not contain an entity?
|
||||||
|
require
|
||||||
|
a_res_not_void: a_res /= Void
|
||||||
|
do
|
||||||
|
Result := a_res.transfered_content_length = 0 -- Is that the right measure?
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,30 @@ inherit
|
|||||||
|
|
||||||
feature -- Method
|
feature -- Method
|
||||||
|
|
||||||
|
do_head (a_req: WSF_REQUEST; a_res: WSF_RESPONSE)
|
||||||
|
-- Respond to `a_req' using `a_res'.
|
||||||
|
deferred
|
||||||
|
ensure then
|
||||||
|
empty_body: is_empty_content (a_res)
|
||||||
|
end
|
||||||
|
|
||||||
|
do_post (a_req: WSF_REQUEST; a_res: WSF_RESPONSE)
|
||||||
|
-- Respond to `a_req' using `a_res'.
|
||||||
|
deferred
|
||||||
|
ensure then
|
||||||
|
non_empty_body: a_res.status_code = {HTTP_STATUS_CODE}.created implies
|
||||||
|
not is_empty_content (a_res)
|
||||||
|
location_header: a_res.status_code = {HTTP_STATUS_CODE}.created implies True -- WSF_RESPONSE needs enhancing
|
||||||
|
end
|
||||||
|
|
||||||
|
do_trace (a_req: WSF_REQUEST; a_res: WSF_RESPONSE)
|
||||||
|
-- Respond to `a_req' using `a_res'.
|
||||||
|
deferred
|
||||||
|
ensure then
|
||||||
|
non_empty_body: a_res.status_code = {HTTP_STATUS_CODE}.ok implies
|
||||||
|
not is_empty_content (a_res)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ feature -- Method OPTIONS
|
|||||||
|
|
||||||
do_options (req: WSF_REQUEST; res: WSF_RESPONSE)
|
do_options (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
|
-- TODO - implement a default method that lists the accepted methods for the resource.
|
||||||
handle_not_implemented ("Method OPTIONS not implemented", req, res)
|
handle_not_implemented ("Method OPTIONS not implemented", req, res)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ feature -- Mapping
|
|||||||
map_with_request_methods (a_mapping: WSF_ROUTER_MAPPING; rqst_methods: detachable WSF_ROUTER_METHODS)
|
map_with_request_methods (a_mapping: WSF_ROUTER_MAPPING; rqst_methods: detachable WSF_ROUTER_METHODS)
|
||||||
-- Map `a_mapping' for request methods `rqst_methods'
|
-- Map `a_mapping' for request methods `rqst_methods'
|
||||||
do
|
do
|
||||||
if attached rqst_methods as l_rm and then l_rm.has ("GET") then
|
if attached rqst_methods as l_rm and then l_rm.has ({HTTP_REQUEST_METHODS}.method_get) then
|
||||||
l_rm.enable_head
|
l_rm.enable_head
|
||||||
end
|
end
|
||||||
mappings.extend (create {WSF_ROUTER_ITEM}.make_with_request_methods (a_mapping, rqst_methods))
|
mappings.extend (create {WSF_ROUTER_ITEM}.make_with_request_methods (a_mapping, rqst_methods))
|
||||||
|
|||||||
Reference in New Issue
Block a user