"End of file reached" error OR Zlib::BufError using HTTParty -


i experiencing 2 different errors - depending on whether use httparty in ruby app or use command line.

url trying access: http://apiv2.ahrefs.com/?token=$insert_valid_ahrefs_api_token&from=backlinks&output=json&mode=domain&target=blog.ahrefs.com&limit=1000 http method: get

when directly in bundle console zlib::buferror:

httparty.get "http://apiv2.ahrefs.com/?token=$insert_valid_ahrefs_api_token&from=backlinks_new_lost&output=json&mode=domain&target=blog.ahrefs.com&limit=1000"

zlib::buferror: buffer error     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http/response.rb:357:in `finish'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http/response.rb:357:in `finish'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http/response.rb:262:in `ensure in inflater'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http/response.rb:262:in `inflater'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http/response.rb:274:in `read_body_0'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http/response.rb:201:in `read_body'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http/response.rb:226:in `body'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http/response.rb:163:in `reading_body'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:1414:in `block in transport_request'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:1405:in `catch'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:1405:in `transport_request'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:1378:in `request'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:1371:in `block in request'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:853:in `start'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:1369:in `request'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/httparty-0.13.3/lib/httparty/request.rb:98:in `perform'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/httparty-0.13.3/lib/httparty.rb:539:in `perform_request'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/httparty-0.13.3/lib/httparty.rb:475:in `get'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/httparty-0.13.3/lib/httparty.rb:577:in `get'     (irb):3     /users/medic/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/cli/console.rb:38:in `run'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/cli.rb:287:in `console'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/vendor/thor/command.rb:27:in `run'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/vendor/thor.rb:363:in `dispatch'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/vendor/thor/base.rb:440:in `start'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/cli.rb:9:in `start'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/bin/bundle:20:in `block in <top (required)>'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/bin/bundle:20:in `<top (required)>'     /users/medic/.rbenv/versions/2.1.2/bin/bundle:23:in `load'     /users/medic/.rbenv/versions/2.1.2/bin/bundle:23:in `<main>'irb(main):004:0>  

same error occurs following command: net::http.get(uri('http://apiv2.ahrefs.com/?token=$ahrefs_api_token&from=backlinks_new_lost&output=json&mode=domain&target=blog.ahrefs.com&limit=1000'))

when command line:

httparty "http://apiv2.ahrefs.com/?token=$insert_valid_ahrefs_api_token&from=backlinks_new_lost&output=json&mode=domain&target=blog.ahrefs.com&limit=1000"

/users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/protocol.rb:153:in `read_nonblock': end of file reached (eoferror)     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/protocol.rb:153:in `rbuf_fill'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/protocol.rb:104:in `read'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http/response.rb:316:in `ensure in read_chunked'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http/response.rb:316:in `read_chunked'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http/response.rb:276:in `block in read_body_0'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http/response.rb:269:in `inflater'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http/response.rb:274:in `read_body_0'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http/response.rb:201:in `read_body'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http/response.rb:226:in `body'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http/response.rb:163:in `reading_body'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:1414:in `block in transport_request'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:1405:in `catch'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:1405:in `transport_request'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:1378:in `request'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:1371:in `block in request'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:853:in `start'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:1369:in `request'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/httparty-0.13.3/lib/httparty/request.rb:98:in `perform'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/httparty-0.13.3/lib/httparty.rb:539:in `perform_request'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/httparty-0.13.3/lib/httparty.rb:475:in `get'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/httparty-0.13.3/lib/httparty.rb:577:in `get'     /users/medic/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/httparty-0.13.3/bin/httparty:90:in `<top (required)>'     /users/medic/.rbenv/versions/2.1.2/bin/httparty:23:in `load'     /users/medic/.rbenv/versions/2.1.2/bin/httparty:23:in `<main>' 

the problem disappears when reduce limit query parameter limit=10.

my assumption because server returns chunked response, if there enough data.

i tested url curl , worked without hitch. that's why assuming problem in httparty


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -