Project

General

Profile

Bug #10484 ยป ruby_weird_gzip.patch

charsyam (DaeMyung Kang), 11/07/2014 08:13 AM

View differences:

ext/zlib/zlib.c
#define ZSTREAM_EXPAND_BUFFER_OK 0
#define AVAIL_IN_IS_EMTPY(z) ((z)->stream.avail_in == 0)
/* I think that more better value should be found,
but I gave up finding it. B) */
#define ZSTREAM_INITIAL_BUFSIZE 1024
......
VALUE dst, self = (VALUE)z->stream.opaque;
if (!ZSTREAM_IS_FINISHED(z) && !ZSTREAM_IS_GZFILE(z) &&
rb_block_given_p()) {
!AVAIL_IN_IS_EMTPY(z) && rb_block_given_p()) {
/* prevent tiny yields mid-stream, save for next
* zstream_expand_buffer() or stream end */
return Qnil;
lib/net/http/response.rb
e = $!
begin
inflate_body_io.finish
rescue
raise e
rescue => e2
raise e unless e2.class == Zlib::BufError
#skip Zlib::BufError when call finish.
#to keep compatibility for broken compress block
end
end
when 'none', 'identity' then
    (1-1/1)