Skip to content

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

Closed

Description

@LukaszMaslej

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

Activity

  1. 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[/+] on Nov 9, 2020
  2. woutdegeyter commented on Nov 10, 2020

    @woutdegeyter

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

  3. tarcieri commented on Nov 10, 2020

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions