tag:help.rubygems.org,2010-01-19:/discussions/problems/768-installing-or-updating-any-gem-fails-with-zlibdataerror-incorrect-header-checkRubyGems.org: Discussion 2018-10-18T19:51:10Ztag:help.rubygems.org,2010-01-19:Comment/112190562011-11-07T20:51:01Z2012-08-04T18:40:10ZInstalling or updating any gem fails with "(Zlib::DataError) incorrect header check"<div><p>I had a very frustrating weekend.. I was unable to install or
update any gems.</p>
<p>Every attempt to install or update a gem produced:</p>
<pre>
<code>ERROR: While executing gem ... (Zlib::DataError)
incorrect header check.</code>
</pre>
<p>After eliminating every conceivable cause and following several
wild goose chases, I eventually discovered that the rubygem mirrors
had been miscategorized and blocked by a corporate web filter. I
added some debugging that allowed me to see the url's and the issue
became apparent.</p>
<p><a href=
"http://production.cf.rubygems.org/quick/Marshal.4.8/rake-0.9.2.2.gemspec.rz">
http://production.cf.rubygems.org/quick/Marshal.4.8/rake-0.9.2.2.ge...</a></p>
<p>was being hijacked, and instead of rake-0.9.2.2.gemspec.rz, it
was getting html to the effect of:</p>
<pre>
<code>Content blocked by your organization
Reason: This Websense category is filtered: Blogs and Personal Sites.
URL: http://production.cf.rubygems.org/quick/Marshal.4.8/rake-0.9.2.2.gemspec.rz</code>
</pre>
<p>So.. if you're having issues with gems, make sure the requests
aren't being hijacked or magled by something..</p>
<p>It would also seem appropriate for gem to do some content
verification before blindly sending to zlib. It would have been
extremely helpful to know the returned content did not match the
expected mime type, content length, and certainly didn't produce a
correct hash.</p></div>wmb