Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting Timeout::Error but site is available and from curl gets a 200 #253

Closed
tiagolnobre opened this issue Nov 13, 2013 · 5 comments
Closed

Comments

@tiagolnobre
Copy link

using ruby 1.9.3
gem version 0.12.0
url: http://iopscience.iop.org/1758-5090/5/1/015013

invoking
response = HTTParty.get(url)

getting a Timeout::Error

debug_output:

opening connection to iopscience.iop.org...
opened
<- "GET /1758-5090/5/1/015013 HTTP/1.1\r\nConnection: close\r\nHost: iopscience.iop.org\r\n\r\n"
Conn close because of error Timeout::Error

but when invoking from bash with curl
curl -o /dev/null --silent --head --write-out '%{http_code}\n' "http://iopscience.iop.org/1758-5090/5/1/015013"
getting a 200

@jnunemaker
Copy link
Owner

Definitely seeing this as well. I do not see it with curl or with Net::HTTP.get_response. That said, the odd thing is that it seems stuck in net/protocol, not anywhere in httparty. I don't have more time to investigate right now.

@jaumeprat-twt
Copy link

I have the same problem. Suddenly and without changes in my code I'm having the same problem. In my case I'm using this gem to get the metadata of Videos from Vimeo:

HTTParty.get('http://vimeo.com/api/v2/video/45230972.xml')
Net::ReadTimeout: Net::ReadTimeout

without HTTParty works:

Net::HTTP.get_response(URI( 'http://vimeo.com/api/v2/video/45230972.xml' ))
#<Net::HTTPOK 200 OK readbody=true>

Anyone an Idea?
tested with ruby 1.9.3, 2.0 and 2.1

@jarinudom
Copy link

I had a similar problem, and I think I've got it tracked down (although mine was different because I was seeing it across curl, HTTParty, and Net::HTTP).

The connection was timing out because DNS was trying to resolve addresses via IPv6 first and timing out (I think partially because the URL I was requesting had an IPv6 NS entry but no actual nameserver there).

Anyway, I disabled IPv6 on my web server and it all works fine and dandy now. I couldn't find an option in HTTParty to force IPv4 requests, but if that's possible it would be an even better solution.

@mikegee
Copy link

mikegee commented Jun 5, 2014

This issue is a bit stale, and not clearly a problem in HTTParty. Wanna just close it?

@JsonSam
Copy link

JsonSam commented Oct 8, 2014

What is the solution to the above issue?

TRMW added a commit to TRMW/blitzentrapper that referenced this issue Feb 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants