Commit 240bf638 authored by David Kim's avatar David Kim Committed by Stan Hu

Support 303 redirects when downloading via CommandLineUtil

It's an attempt to make Gitlab::HTTP redirection following behaviour
the same as OpenURI which we were using before.
parent 53920cb3
......@@ -66,7 +66,7 @@ module Gitlab
current_size = 0
Gitlab::HTTP.get(url, stream_body: true, allow_object_storage: true) do |fragment|
if [301, 302, 307].include?(fragment.code)
if [301, 302, 303, 307].include?(fragment.code)
Gitlab::Import::Logger.warn(message: "received redirect fragment", fragment_code: fragment.code)
elsif fragment.code == 200
current_size += fragment.bytesize
......
......@@ -114,7 +114,7 @@ RSpec.describe Gitlab::ImportExport::CommandLineUtil do
end
end
%w[MOVED_PERMANENTLY FOUND TEMPORARY_REDIRECT].each do |code|
%w[MOVED_PERMANENTLY FOUND SEE_OTHER TEMPORARY_REDIRECT].each do |code|
context "with a redirect status code #{code}" do
let(:status) { HTTP::Status.const_get(code, false) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment