Skip to content

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

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

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