diff --git a/.gitignore b/.gitignore index 332345d9..8a87455f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ tests/temp/ .svn/ *.swp *~ +*.scm *# diff --git a/library/server/ewsgi/specification/request/wgi_meta_names.e b/library/server/ewsgi/specification/request/wgi_meta_names.e index c4f9ee81..95f659e6 100644 --- a/library/server/ewsgi/specification/request/wgi_meta_names.e +++ b/library/server/ewsgi/specification/request/wgi_meta_names.e @@ -43,6 +43,8 @@ feature -- Access http_accept_language: STRING = "HTTP_ACCEPT_LANGUAGE" http_connection: STRING = "HTTP_CONNECTION" + + http_content_range: STRING = "HTTP_CONTENT_RANGE" http_expect: STRING = "HTTP_EXPECT" diff --git a/library/server/ewsgi/specification/request/wgi_request.e b/library/server/ewsgi/specification/request/wgi_request.e index 697e0ba2..e3dd9cbb 100644 --- a/library/server/ewsgi/specification/request/wgi_request.e +++ b/library/server/ewsgi/specification/request/wgi_request.e @@ -639,6 +639,11 @@ feature -- HTTP_* deferred end + http_content_range: detachable READABLE_STRING_8 + -- Partial range of selected representation enclosed in message payload + deferred + end + feature -- Extra CGI environment variables request_uri: READABLE_STRING_8 diff --git a/library/server/ewsgi/src/implementation/wgi_request_from_table.e b/library/server/ewsgi/src/implementation/wgi_request_from_table.e index 4368bb33..83e9ebff 100644 --- a/library/server/ewsgi/src/implementation/wgi_request_from_table.e +++ b/library/server/ewsgi/src/implementation/wgi_request_from_table.e @@ -289,7 +289,13 @@ feature -- Access: HTTP_* CGI meta parameters - 1.1 do Result := meta_string_variable ({WGI_META_NAMES}.http_range) end - + + http_content_range: detachable READABLE_STRING_8 + -- Partial range of selected representation enclosed in message payload + do + Result := meta_string_variable ({WGI_META_NAMES}.http_content_range) + end + feature -- Access: Extension to CGI meta parameters - 1.1 request_uri: READABLE_STRING_8 diff --git a/library/server/wsf/policy_driven/wsf_skeleton_handler.e b/library/server/wsf/policy_driven/wsf_skeleton_handler.e index 48b88423..d4b5bb79 100644 --- a/library/server/wsf/policy_driven/wsf_skeleton_handler.e +++ b/library/server/wsf/policy_driven/wsf_skeleton_handler.e @@ -464,7 +464,9 @@ feature -- Execution if req.is_request_method ({HTTP_REQUEST_METHODS}.method_options) then execute_options (req, res, router) else - if attached new_method_helper (req.request_method) as l_helper then + if req.is_request_method ({HTTP_REQUEST_METHODS}.method_put) and attached req.http_content_range then + handle_invalid_content_range (res) + elseif attached new_method_helper (req.request_method) as l_helper then execute_method (req, res, l_helper) else handle_internal_server_error (res) @@ -515,7 +517,29 @@ feature -- Execution end feature {NONE} -- Implementation - + + handle_invalid_content_range (res: WSF_RESPONSE) + -- Write "Bad Request" response to `res' for Content-Range header present in PUT request. + require + res_attached: res /= Void + local + h: HTTP_HEADER + m: STRING_8 + do + create h.make + h.put_content_type_text_plain + m := "Content-Range header present in PUT request" + h.put_content_length (m.count) + h.put_current_date + res.set_status_code ({HTTP_STATUS_CODE}.bad_request) + res.put_header_lines (h) + res.put_string (m) + ensure + response_status_is_set: res.status_is_set + status_is_service_unavailable: res.status_code = {HTTP_STATUS_CODE}.internal_server_error + body_sent: res.message_committed and then res.transfered_content_length > 0 + end + handle_internal_server_error (res: WSF_RESPONSE) -- Write "Internal Server Error" response to `res'. require diff --git a/library/server/wsf/src/wsf_request.e b/library/server/wsf/src/wsf_request.e index 081f0268..8164e28b 100644 --- a/library/server/wsf/src/wsf_request.e +++ b/library/server/wsf/src/wsf_request.e @@ -1227,7 +1227,13 @@ feature -- HTTP_* do Result := wgi_request.http_range end - + + http_content_range: detachable READABLE_STRING_8 + -- Partial range of selected representation enclosed in message payload + do + Result := wgi_request.http_content_range + end + feature -- Extra CGI environment variables request_uri: READABLE_STRING_8