Method: Mechanize::HTTP::Agent#content_encoding_inflate
- Defined in:
- lib/mechanize/http/agent.rb
#content_encoding_inflate(body_io) ⇒ Object
Decodes a deflate-encoded body_io. If it cannot be decoded, raw inflate is tried followed by raising an error.
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 |
# File 'lib/mechanize/http/agent.rb', line 486 def content_encoding_inflate body_io log.debug('deflate body') if log return inflate body_io rescue Zlib::Error log.error('unable to inflate response, trying raw deflate') if log body_io.rewind begin return inflate body_io, -Zlib::MAX_WBITS rescue Zlib::Error => e log.error("unable to inflate response: #{e}") if log raise end ensure body_io.close end |