tenderlove/mechanize — Issue #198: "Zlib::BufError: buffer error" on Heroku Cedar
Author: be9
Created: 2012-02-07 06:00:45+00:00
State: open

I've stumbled upon realy weird bug after upgrade to mechanize 2.1.

The following code

``` ruby
url = "http://www.zappos.com/sperry-top-sider-authentic-original-sahara"
agent = Mechanize.new
agent.redirection_limit = 5
agent.open_timeout = 10
agent.read_timeout = 10
agent.head url
```

results in

```
Zlib::BufError: buffer error
from /app/vendor/bundle/ruby/1.9.1/gems/mechanize-2.1/lib/mechanize/http/agent.rb:932:in `finish'
from /app/vendor/bundle/ruby/1.9.1/gems/mechanize-2.1/lib/mechanize/http/agent.rb:932:in `inflate'
from /app/vendor/bundle/ruby/1.9.1/gems/mechanize-2.1/lib/mechanize/http/agent.rb:708:in `rescue in response_content_encoding'
from /app/vendor/bundle/ruby/1.9.1/gems/mechanize-2.1/lib/mechanize/http/agent.rb:714:in `response_content_encoding'
from /app/vendor/bundle/ruby/1.9.1/gems/mechanize-2.1/lib/mechanize/http/agent.rb:274:in `fetch'
from /app/vendor/bundle/ruby/1.9.1/gems/mechanize-2.1/lib/mechanize.rb:339:in `head'
from (irb):23
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/commands/console.rb:47:in `start'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/commands/console.rb:8:in `start'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/commands.rb:41:in `'
from script/rails:6:in `require'
from script/rails:6:in `

'
```
(run from Heroku console)

There are more URLs that cause the same problem.

`agent.get(url)` works. This same code on my dev machine (Ubuntu 11.10, ruby 1.9.3) works. This same code run against mechanize 2.0.1 on Heroku works as well.

For now I've downgraded to 2.0.1, but there definitely is some incompatibility of unknown nature.