codingjester / tumblr_client

A Ruby Wrapper for the Tumblr v2 API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Net::HTTPBadResponse: wrong status line: "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\""

monfresh opened this issue · comments

I've been getting this error a lot when querying the API, even when just using it via the Terminal. For example, I run tumblr using a valid secret and token (as saved in the .tumblr file), then I do client = Tumblr.new, and if I try

blogs = client.info["user"]["blogs"]

sometimes I get a response, and sometimes I get the HTTPBadResponse.

Any idea why this could be happening?

Here is the full trace:

Net::HTTPBadResponse: wrong status line: "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\""
    from /Users/orangina/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:2564:in `read_status_line'
    from /Users/orangina/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:2551:in `read_new'
    from /Users/orangina/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:1319:in `block in transport_request'
    from /Users/orangina/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:1316:in `catch'
    from /Users/orangina/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:1316:in `transport_request'
    from /Users/orangina/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:1293:in `request'
    from /Users/orangina/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:1286:in `block in request'
    from /Users/orangina/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:745:in `start'
    from /Users/orangina/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:1284:in `request'
    from /Users/orangina/.rvm/gems/ruby-1.9.3-p125@fmtt/gems/faraday-0.7.6/lib/faraday/adapter/net_http.rb:61:in `call'
    from /Users/orangina/.rvm/gems/ruby-1.9.3-p125@fmtt/gems/faraday_middleware-0.8.7/lib/faraday_middleware/response_middleware.rb:30:in `call'
    from /Users/orangina/.rvm/gems/ruby-1.9.3-p125@fmtt/gems/faraday-0.7.6/lib/faraday/request/url_encoded.rb:14:in `call'
    from /Users/orangina/.rvm/gems/ruby-1.9.3-p125@fmtt/gems/tumblr_client-0.6.5/lib/tumblr/request/oauth.rb:27:in `call'
    from /Users/orangina/.rvm/gems/ruby-1.9.3-p125@fmtt/gems/faraday-0.7.6/lib/faraday/connection.rb:210:in `run_request'
    from /Users/orangina/.rvm/gems/ruby-1.9.3-p125@fmtt/gems/faraday-0.7.6/lib/faraday/connection.rb:98:in `post'
    from /Users/orangina/.rvm/gems/ruby-1.9.3-p125@fmtt/gems/tumblr_client-0.6.5/lib/tumblr/request.rb:18:in `post'
    from /Users/orangina/.rvm/gems/ruby-1.9.3-p125@fmtt/gems/tumblr_client-0.6.5/lib/tumblr/user.rb:5:in `info'
    from (irb):3
    from /Users/orangina/.rvm/gems/ruby-1.9.3-p125@fmtt/gems/tumblr_client-0.6.5/bin/tumblr:32:in `<top (required)>'
    from /Users/orangina/.rvm/gems/ruby-1.9.3-p125@fmtt/bin/tumblr:19:in `load'
    from /Users/orangina/.rvm/gems/ruby-1.9.3-p125@fmtt/bin/tumblr:19:in `<main>'1.9.3p125 :004 >

bad response is a server issue. I'll have the client handle that a bit more gracefully.

John Bunting

Simplicity is a prerequisite for reliability
--Edsger W. Dijkstra

On Thursday, May 3, 2012 at 5:32 PM, monfresh wrote:

I've been getting this error a lot when querying the API, even when just using it via the Terminal. For example, I run tumblr using a valid secret and token (as saved in the .tumblr file), then I do client = Tumblr.new, and if I try

blogs = blogs = client.info (http://client.info)["user"]["blogs"]

sometimes I get a response, and sometimes I get the HTTPBadResponse.

Any idea why this could be happening?


Reply to this email directly or view it on GitHub:
#9

More recent versions of faraday fix this issue (as of 10 months ago)
see: lostisland/faraday@3cb8fb2

Our current version requirement (>= 0.8.0) catches this fix also:
https://github.com/lostisland/faraday/blob/v0.8.0/lib/faraday/adapter/net_http.rb

Closing this - please re-open if you are still seeing issues