Follow redirection only for redirection http status 3** .
This commit is contained in:
@@ -266,7 +266,7 @@ feature -- Access
|
|||||||
s.append_character (':')
|
s.append_character (':')
|
||||||
s.append_integer (l_port)
|
s.append_integer (l_port)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
s.append (http_end_of_header_line)
|
s.append (http_end_of_header_line)
|
||||||
if not headers.has ("Connection") then
|
if not headers.has ("Connection") then
|
||||||
if l_is_http_1_0_request then
|
if l_is_http_1_0_request then
|
||||||
@@ -400,7 +400,10 @@ feature -- Access
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- follow redirect
|
-- follow redirect
|
||||||
if l_location /= Void then
|
if
|
||||||
|
is_redirection_http_status (Result.status) and
|
||||||
|
l_location /= Void
|
||||||
|
then
|
||||||
if Result.redirections_count < max_redirects then
|
if Result.redirections_count < max_redirects then
|
||||||
initialize (l_location, ctx)
|
initialize (l_location, ctx)
|
||||||
redirection_response := response
|
redirection_response := response
|
||||||
@@ -453,6 +456,12 @@ feature {NONE} -- Helpers
|
|||||||
Result := a_socket.ready_for_reading
|
Result := a_socket.ready_for_reading
|
||||||
end
|
end
|
||||||
|
|
||||||
|
is_redirection_http_status (a_status: INTEGER): BOOLEAN
|
||||||
|
-- Is http status `a_status` a redirection response?
|
||||||
|
do
|
||||||
|
Result := a_status >= 300 and a_status < 400
|
||||||
|
end
|
||||||
|
|
||||||
form_date_and_uploaded_files_to_mime_string (a_form_parameters: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_32]; a_upload_filename: detachable READABLE_STRING_GENERAL; a_mime_boundary: READABLE_STRING_8): STRING
|
form_date_and_uploaded_files_to_mime_string (a_form_parameters: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_32]; a_upload_filename: detachable READABLE_STRING_GENERAL; a_mime_boundary: READABLE_STRING_8): STRING
|
||||||
-- Form data and uploaded files converted to mime string.
|
-- Form data and uploaded files converted to mime string.
|
||||||
-- TODO: design a proper MIME... component.
|
-- TODO: design a proper MIME... component.
|
||||||
|
|||||||
Reference in New Issue
Block a user