Issue #143
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,4 +3,5 @@ tests/temp/
|
||||
.svn/
|
||||
*.swp
|
||||
*~
|
||||
*.scm
|
||||
*#
|
||||
|
||||
@@ -44,6 +44,8 @@ feature -- Access
|
||||
|
||||
http_connection: STRING = "HTTP_CONNECTION"
|
||||
|
||||
http_content_range: STRING = "HTTP_CONTENT_RANGE"
|
||||
|
||||
http_expect: STRING = "HTTP_EXPECT"
|
||||
|
||||
http_referer: STRING = "HTTP_REFERER"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -290,6 +290,12 @@ feature -- Access: HTTP_* CGI meta parameters - 1.1
|
||||
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
|
||||
|
||||
@@ -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)
|
||||
@@ -516,6 +518,28 @@ feature -- Execution
|
||||
|
||||
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
|
||||
|
||||
@@ -1228,6 +1228,12 @@ feature -- HTTP_*
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user