Do not set default status if a status is already set.

This commit is contained in:
Jocelyn Fiat
2012-10-22 11:15:52 +02:00
parent fb3148aeea
commit 84d1f20fd0

View File

@@ -290,6 +290,7 @@ feature -- Redirect
header_not_committed: not header_committed header_not_committed: not header_committed
local local
h: HTTP_HEADER h: HTTP_HEADER
b: READABLE_STRING_8
do do
if header_committed then if header_committed then
-- This might be a trouble about content-length -- This might be a trouble about content-length
@@ -302,15 +303,18 @@ feature -- Redirect
end end
h.put_location (a_url) h.put_location (a_url)
if a_status_code = 0 then if a_status_code = 0 then
set_status_code ({HTTP_STATUS_CODE}.temp_redirect) if not status_is_set then
set_status_code ({HTTP_STATUS_CODE}.temp_redirect)
end
else else
set_status_code (a_status_code) set_status_code (a_status_code)
end end
if a_content /= Void then if a_content /= Void then
h.put_content_length (a_content.body.count) b := a_content.body
h.put_content_length (b.count)
h.put_content_type (a_content.type) h.put_content_type (a_content.type)
put_header_text (h.string) put_header_text (h.string)
put_string (a_content.body) put_string (b)
else else
h.put_content_length (0) h.put_content_length (0)
put_header_text (h.string) put_header_text (h.string)