Print

Print


On Wed, Nov 9, 2011 at 3:47 PM, Yitzchak Schaffer
<[log in to unmask]> wrote:
>
> yitzchas@ubu-dev:/www/websites/drupal/sites/all$ curl
> "http://www.questionpoint.org/crs/servlet/org.oclc.chat.QPWOnlineStatus?library=10253&rid=0"
> -m 3 -v
> * name lookup timed out
> * Couldn't resolve host 'www.questionpoint.org'
> * Closing connection #0
> curl: (6) name lookup timed out

The nameservers for questionpoint.org appear to not respond to queries
for AAAA records. Expected behavior would be to return an empty
response.

curl is trying to look up both the A and the AAAA records, and the
system resolver's timeout is larger than 3 seconds, so curl times out.
Dropping the -m3 would let curl complete, but it would take about 15
seconds.

If you pass -4 as an option to curl, this should work around the issue
by skipping the IPv6 lookup.

If using libcurl in php, you should be able to use the CURL_IPRESOLVE_V4 option.

I don't know offhand if file_get_contents can be instructed to force IPv4.

Another option, since I believe all of the above use the libc resolver
library -- you can hardcode the IPv4 address in /etc/hosts -- that
will break when the IP changes.

There are a few other possible workarounds, but hopefully one of the
above works acceptably.

-jeff