cleverbot-api icon indicating copy to clipboard operation
cleverbot-api copied to clipboard

Incorrect header check error?

Open dangeredwolf opened this issue 10 years ago • 3 comments

Whenever I make a request with this Cleverbot API it always has an error like this:

@cleverbotChats: ERROR: Zlib::DataError: incorrect header check /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:357:in finish' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:357:infinish' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:262:in ensure in inflater' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:262:ininflater' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:274:in read_body_0' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:201:inread_body' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1391:in block in send_entity' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1413:inblock (2 levels) in transport_request' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:162:in reading_body' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1412:inblock in transport_request' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1403:in catch' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1403:intransport_request' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1376:in request' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1369:inblock in request' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:852:in start' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1367:inrequest' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1390:in send_entity' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1179:inpost' /Library/Ruby/Gems/2.0.0/gems/cleverbot-api-0.0.4/lib/cleverbot-api.rb:43:in make_request' /Library/Ruby/Gems/2.0.0/gems/cleverbot-api-0.0.4/lib/cleverbot-api.rb:23:inthink' /Users/ryandolan123/cleverbot/bots.rb:58:in `block (2 levels) in <top (required)>'

Is this because of Cleverbot API changes? Or Ruby 2.0.0 incompatibility?

dangeredwolf avatar Jun 27 '14 19:06 dangeredwolf

There seems to be a problem with the net/http library in Ruby 2.0+ related to decompressing gzipped headers. The fastest fix is to just use RestClient instead. In case you're still looking, you can use my fork at https://github.com/neilgupta/cleverbot-api for a working version:

gem 'cleverbot-api', :git => 'git://github.com/neilgupta/cleverbot-api.git'

neilgupta avatar Sep 15 '14 19:09 neilgupta

@neilgupta When I try to put your line of code in my gem file and bundle install, it seems like the gem isn't actually being installed.

/Users/Charles/.rbenv/versions/2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- cleverbot-api (LoadError)
    from /Users/Charles/.rbenv/versions/2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from bots.rb:1:in `<main>'

When I do the following it works:

  1. git clone 'git://github.com/neilgupta/cleverbot-api.git'
  2. cd cleverbot-api/
  3. gem build cleverbot-api.gemspec
  4. sudo gem install cleverbot-api

Is there something I'm missing? Ideally I want to be able to just stick your fork of cleverbot in my gemfile and bundle install without having to actually build the gem manually in the command line.

Apologies if I'm missing something obvious. My first time trying to pull gem from a github repo.

cgardens avatar Feb 25 '15 08:02 cgardens

If you check your Gemfile.lock, do you see the cleverbot-api gem properly loaded from my github fork? If yes, my first guess would be this is a configuration problem with rbenv not finding the bundler installed gem, but it is able to find it when you install it to the whole system via gem install.

Are you prefixing your start command with bundle exec (ie bundle exec rails s)? If not, try that.

neilgupta avatar Feb 25 '15 20:02 neilgupta