- (WGI|WSF)_RESPONSE(*) renamed write_headers_string as write_header_text
- HTTP_HEADER.string does not have the ending CRLFCRLF .. but just CRLF - WGI_RESPONSE.write_header_text has the responsibility to handle the last blank line CRLF (separating the header from the message) - HTTP_HEADER.string does not set anymore a default content type as text/html - added WGI_RESPONSE.write_header_lines (ITERABLE [TUPLE [name,value: READABLE_STRING_8]] mainly as an helper method, this way the WGI user does not have to know about the CRLF end of line
This commit is contained in:
@@ -177,7 +177,7 @@ feature -- Handle responses
|
||||
h.put_content_length (a_description.count)
|
||||
h.put_current_date
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.bad_request)
|
||||
res.write_headers_string (h.string)
|
||||
res.write_header_text (h.string)
|
||||
res.write_string (a_description)
|
||||
end
|
||||
|
||||
@@ -192,7 +192,7 @@ feature -- Handle responses
|
||||
h.put_content_length (a_description.count)
|
||||
h.put_current_date
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.precondition_failed)
|
||||
res.write_headers_string (h.string)
|
||||
res.write_header_text (h.string)
|
||||
res.write_string (a_description)
|
||||
end
|
||||
|
||||
@@ -206,7 +206,7 @@ feature -- Handle responses
|
||||
h.put_content_length (a_description.count)
|
||||
h.put_current_date
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.internal_server_error)
|
||||
res.write_headers_string (h.string)
|
||||
res.write_header_text (h.string)
|
||||
res.write_string (a_description)
|
||||
end
|
||||
|
||||
@@ -220,7 +220,7 @@ feature -- Handle responses
|
||||
h.put_content_length (a_description.count)
|
||||
h.put_current_date
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.not_implemented)
|
||||
res.write_headers_string (h.string)
|
||||
res.write_header_text (h.string)
|
||||
res.write_string (a_description)
|
||||
end
|
||||
|
||||
@@ -234,7 +234,7 @@ feature -- Handle responses
|
||||
h.put_content_length (a_description.count)
|
||||
h.put_current_date
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.method_not_allowed)
|
||||
res.write_headers_string (h.string)
|
||||
res.write_header_text (h.string)
|
||||
res.write_string (a_description)
|
||||
end
|
||||
|
||||
@@ -248,7 +248,7 @@ feature -- Handle responses
|
||||
h.put_content_length (a_description.count)
|
||||
h.put_current_date
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.not_found)
|
||||
res.write_headers_string (h.string)
|
||||
res.write_header_text (h.string)
|
||||
res.write_string (a_description)
|
||||
end
|
||||
|
||||
@@ -264,7 +264,7 @@ feature -- Handle responses
|
||||
h.put_content_length (a_description.count)
|
||||
h.put_current_date
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.not_modified)
|
||||
res.write_headers_string (h.string)
|
||||
res.write_header_text (h.string)
|
||||
res.write_string (a_description)
|
||||
end
|
||||
|
||||
@@ -279,7 +279,7 @@ feature -- Handle responses
|
||||
h.put_content_length (a_description.count)
|
||||
h.put_current_date
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.conflict)
|
||||
res.write_headers_string (h.string)
|
||||
res.write_header_text (h.string)
|
||||
res.write_string (a_description)
|
||||
end
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ feature -- Execution
|
||||
|
||||
h.put_content_length (s.count)
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.ok)
|
||||
res.write_headers_string (h.string)
|
||||
res.write_header_text (h.string)
|
||||
res.write_string (s)
|
||||
end
|
||||
end
|
||||
@@ -136,7 +136,7 @@ feature -- Execution
|
||||
h.put_content_type_text_html
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.ok)
|
||||
h.put_content_length (s.count)
|
||||
res.write_headers_string (h.string)
|
||||
res.write_header_text (h.string)
|
||||
if not req.request_method.same_string ({HTTP_REQUEST_METHODS}.method_head) then
|
||||
res.write_string (s)
|
||||
end
|
||||
@@ -161,13 +161,13 @@ feature -- Execution
|
||||
h.put_content_type (ct)
|
||||
h.put_content_length (f.count)
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.ok)
|
||||
res.write_headers_string (h.string)
|
||||
res.write_header_text (h.string)
|
||||
else
|
||||
create h.make
|
||||
h.put_content_type ({HTTP_MIME_TYPES}.application_force_download)
|
||||
h.put_content_length (f.count)
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.ok)
|
||||
res.write_headers_string (h.string)
|
||||
res.write_header_text (h.string)
|
||||
end
|
||||
if not req.request_method.same_string ({HTTP_REQUEST_METHODS}.method_head) then
|
||||
res.write_file_content (fn)
|
||||
@@ -186,7 +186,7 @@ feature -- Execution
|
||||
s.append ("Resource %"" + uri + "%" not found%N")
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.not_found)
|
||||
h.put_content_length (s.count)
|
||||
res.write_headers_string (h.string)
|
||||
res.write_header_text (h.string)
|
||||
res.write_string (s)
|
||||
res.flush
|
||||
end
|
||||
@@ -202,7 +202,7 @@ feature -- Execution
|
||||
s.append ("Resource %"" + uri + "%": Access denied%N")
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.forbidden)
|
||||
h.put_content_length (s.count)
|
||||
res.write_headers_string (h.string)
|
||||
res.write_header_text (h.string)
|
||||
res.write_string (s)
|
||||
res.flush
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user