Commit 7647af6f authored by Will Chandler's avatar Will Chandler Committed by Stan Hu

Don't use 'accept-encoding' in HttpIO requests

Net::HTTP does not automatically decompress requests sent with a
range header, as is done by HttpIO#request, causing the body of
any gzipped responses to be unreadable.

This change removes the 'accept-encoding' header from requests sent
by HttpIO, ensuring responses are not gzipped.
parent c38ce405
---
title: Don't send 'accept-encoding' in HttpIO requests
merge_request: 28239
author:
type: fixed
......@@ -176,7 +176,7 @@ module Gitlab
end
def request
Net::HTTP::Get.new(uri).tap do |request|
Net::HTTP::Get.new(uri, { 'accept-encoding' => nil }).tap do |request|
request.set_range(chunk_start, BUFFER_SIZE)
end
end
......
......@@ -319,4 +319,12 @@ describe Gitlab::HttpIO do
it { is_expected.to be_truthy }
end
describe '#send' do
subject(:send) { http_io.send(:request) }
it 'does not set the "accept-encoding" header' do
expect(send['accept-encoding']).to be_nil
end
end
end
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