- (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:
Jocelyn Fiat
2011-11-25 20:43:04 +01:00
parent e0ec84611e
commit cdfc6851e7
15 changed files with 78 additions and 38 deletions

View File

@@ -99,7 +99,7 @@ feature -- Execution
h.put_transfer_encoding_chunked
-- h.put_content_length (0)
res.set_status_code ({HTTP_STATUS_CODE}.moved_permanently)
res.write_headers_string (h.string)
res.write_header_text (h.string)
from
create e
@@ -202,7 +202,7 @@ feature -- Execution
h.put_content_type (l_response_content_type)
h.put_content_length (l_body.count)
res.set_status_code ({HTTP_STATUS_CODE}.ok)
res.write_headers_string (h.string)
res.write_header_text (h.string)
res.write_string (l_body)
end
end

View File

@@ -92,7 +92,7 @@ feature -- HTTP Methods
end
h.add_header ("etag:" + etag_utils.md5_digest (l_order.out))
res.set_status_code ({HTTP_STATUS_CODE}.ok)
res.write_headers_string (h.string)
res.write_header_text (h.string)
res.write_string (l_msg)
end
end
@@ -171,7 +171,7 @@ feature -- HTTP Methods
if attached {JSON_VALUE} json.value (l_order) as jv then
h.put_content_length (jv.representation.count)
res.set_status_code ({HTTP_STATUS_CODE}.ok)
res.write_headers_string (h.string)
res.write_header_text (h.string)
res.write_string (jv.representation)
end
end
@@ -214,7 +214,7 @@ feature -- HTTP Methods
h.put_utc_date (time)
end
res.set_status_code ({HTTP_STATUS_CODE}.no_content)
res.write_headers_string (h.string)
res.write_header_text (h.string)
end
do_post (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
@@ -264,7 +264,7 @@ feature -- HTTP Methods
h.put_utc_date (time)
end
res.set_status_code ({HTTP_STATUS_CODE}.created)
res.write_headers_string (h.string)
res.write_header_text (h.string)
res.write_string (l_msg)
end
end

View File

@@ -63,7 +63,7 @@ feature -- Execution
h.put_content_length (l_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 (l_description)
end