Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zlib::BufError in case of empty body response with Content-Encoding and auto_inflate use #624

Closed
LukaszMaslej opened this issue Nov 9, 2020 · 2 comments · Fixed by #625

Comments

@LukaszMaslej
Copy link

LukaszMaslej commented Nov 9, 2020

Hi,

I found edge case where making http request to one of the remote servers can raise Zlib::BufError.The case is about blank body returned by a server for 204 No Content together with header Content-Encoding: gzip .

Can be reproduced this way:

require 'socket'
server = TCPServer.new 8000
loop do

client = server.accept
client.puts <<-EOT
HTTP/1.1 204 No Content
Content-Encoding: gzip
Content-Type: application/json;charset=utf-8

EOT
client.close
end

Call like:

HTTP.use(:auto_inflate, logging: { logger: Logger.new(STDOUT) }).get('http://0.0.0.0:8000')

raise an error ... /gems/http-5.0.0.pre3/lib/http/response/inflater.rb:19:in 'finish': buffer error (Zlib::BufError).

@LukaszMaslej LukaszMaslej changed the title Zlib::BufError in case of empty body response with Content-Encode and auto_inflate use Zlib::BufError in case of empty body response with Content-Encoding and auto_inflate use Nov 9, 2020
@woutdegeyter
Copy link

@tarcieri thank you for merging the fix for this issue!
Could you tell me when we could expect a new httprb release (a new tag) so we could use this fix in our production environment?

@tarcieri
Copy link
Member

Can talk with @ixti about it. I merged your PR but several tests recently started failing, in what appears to be something X.509 related. It would probably be best to get the test suite passing again before cutting another release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants