Follow redirection only for redirection http status 3** .

This commit is contained in:
2017-01-26 22:18:14 +01:00
parent 681151e9b9
commit 7f50409d08

View File

@@ -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.