GithubHelp home page GithubHelp logo

Comments (3)

knu avatar knu commented on May 19, 2024

An example URL of a deflate'd page that the Gzip middleware fails to handle is given in the above issue.
Zlib::Inflate.inflate cannot decode a raw deflate stream.

% curl -L -H 'Accept-Encoding: deflate' 'http://jobboerse.arbeitsagentur.de/vamJB/stellenangeboteFinden.html?execution=e1s1' | ruby -rzlib -e 'Zlib::Inflate.inflate($<.read)'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   423    0   423    0     0    623      0 --:--:-- --:--:-- --:--:--   622
100   451    0   451    0     0    463      0 --:--:-- --:--:-- --:--:--   463
100 11292    0 11292    0     0   8612      0 --:--:--  0:00:01 --:--:-- 2661k
-e:1:in `inflate': incorrect header check (Zlib::DataError)
        from -e:1:in `<main>'

You can confirm Firefox and Chrome can successfully decode the response content with Content-Encoding: deflate using the "Network" tab of their developer tools.

/cc @romanbsd

from faraday_middleware.

knu avatar knu commented on May 19, 2024

Here's a repro.

% ruby -rfaraday -rfaraday_middleware -e 'Faraday.new {|b| b.use FaradayMiddleware::FollowRedirects; b.use :gzip; b.adapter Faraday.default_adapter }.get("http://jobboerse.arbeitsagentur.de/vamJB/stellenangeboteFinden.html?execution=e1s1")'
/..prefix../lib/ruby/gems/2.2.0/gems/faraday_middleware-0.10.0/lib/faraday_middleware/gzip.rb:51:in `inflate': incorrect header check (Zlib::DataError)
        from /..prefix../lib/ruby/gems/2.2.0/gems/faraday_middleware-0.10.0/lib/faraday_middleware/gzip.rb:51:in `inflate'
        from /..prefix../lib/ruby/gems/2.2.0/gems/faraday_middleware-0.10.0/lib/faraday_middleware/gzip.rb:35:in `reset_body'
        from /..prefix../lib/ruby/gems/2.2.0/gems/faraday_middleware-0.10.0/lib/faraday_middleware/gzip.rb:29:in `block in call'
        from /..prefix../lib/ruby/gems/2.2.0/gems/faraday-0.9.1/lib/faraday/response.rb:57:in `on_complete'
        from /..prefix../lib/ruby/gems/2.2.0/gems/faraday_middleware-0.10.0/lib/faraday_middleware/gzip.rb:24:in `call'
        from /..prefix../lib/ruby/gems/2.2.0/gems/faraday_middleware-0.10.0/lib/faraday_middleware/response/follow_redirects.rb:76:in `perform_with_redirection
'
        from /..prefix../lib/ruby/gems/2.2.0/gems/faraday_middleware-0.10.0/lib/faraday_middleware/response/follow_redirects.rb:82:in `block in perform_with_re
direction'
        from /..prefix../lib/ruby/gems/2.2.0/gems/faraday-0.9.1/lib/faraday/response.rb:57:in `on_complete'
        from /..prefix../lib/ruby/gems/2.2.0/gems/faraday_middleware-0.10.0/lib/faraday_middleware/response/follow_redirects.rb:78:in `perform_with_redirection
'
        from /..prefix../lib/ruby/gems/2.2.0/gems/faraday_middleware-0.10.0/lib/faraday_middleware/response/follow_redirects.rb:82:in `block in perform_with_re
direction'
        from /..prefix../lib/ruby/gems/2.2.0/gems/faraday-0.9.1/lib/faraday/response.rb:57:in `on_complete'
        from /..prefix../lib/ruby/gems/2.2.0/gems/faraday_middleware-0.10.0/lib/faraday_middleware/response/follow_redirects.rb:78:in `perform_with_redirection
'
        from /..prefix../lib/ruby/gems/2.2.0/gems/faraday_middleware-0.10.0/lib/faraday_middleware/response/follow_redirects.rb:64:in `call'
        from /..prefix../lib/ruby/gems/2.2.0/gems/faraday-0.9.1/lib/faraday/rack_builder.rb:139:in `build_response'
        from /..prefix../lib/ruby/gems/2.2.0/gems/faraday-0.9.1/lib/faraday/connection.rb:377:in `run_request'
        from /..prefix../lib/ruby/gems/2.2.0/gems/faraday-0.9.1/lib/faraday/connection.rb:140:in `get'
        from -e:1:in `<main>'

from faraday_middleware.

knu avatar knu commented on May 19, 2024

Please review the PR above.

from faraday_middleware.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.