0
0
Fork 0

Validate HTTP response length while receiving (#6891)

to_s method of HTTP::Response keeps blocking while it receives the whole
content, no matter how it is big. This means it may waste time to receive
unacceptably large files. It may also consume memory and disk in the
process. This solves the inefficency by checking response length while
receiving.
This commit is contained in:
Akihiko Odaki 2018-03-26 21:02:10 +09:00 committed by Eugen Rochko
parent 18965cb0e6
commit 40e5d2303b
18 changed files with 115 additions and 26 deletions

View file

@ -29,7 +29,10 @@ RSpec.describe Remotable do
context 'Remotable module is included' do
before do
class Foo; include Remotable; end
class Foo
include Remotable
remotable_attachment :hoge, 1.kilobyte
end
end
let(:attribute_name) { "#{hoge}_remote_url".to_sym }