Project

General

Profile

Bug #10484 ยป ruby_weird_gzip.patch

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

View differences:

ext/zlib/zlib.c
558 558

  
559 559
#define ZSTREAM_EXPAND_BUFFER_OK          0
560 560

  
561
#define AVAIL_IN_IS_EMTPY(z)   ((z)->stream.avail_in == 0)
562

  
561 563
/* I think that more better value should be found,
562 564
   but I gave up finding it. B) */
563 565
#define ZSTREAM_INITIAL_BUFSIZE       1024
......
771 773
    VALUE dst, self = (VALUE)z->stream.opaque;
772 774

  
773 775
    if (!ZSTREAM_IS_FINISHED(z) && !ZSTREAM_IS_GZFILE(z) &&
774
	    rb_block_given_p()) {
776
	      !AVAIL_IN_IS_EMTPY(z) && rb_block_given_p()) {
775 777
	/* prevent tiny yields mid-stream, save for next
776 778
	 * zstream_expand_buffer() or stream end */
777 779
	return Qnil;
lib/net/http/response.rb
262 262
        e = $!
263 263
        begin
264 264
          inflate_body_io.finish
265
        rescue
266
          raise e
265
        rescue => e2
266
          raise e unless e2.class == Zlib::BufError
267
          #skip Zlib::BufError when call finish. 
268
          #to keep compatibility for broken compress block
267 269
        end
268 270
      end
269 271
    when 'none', 'identity' then