cURL unable to interpret hostnames, proxy issue?

1

When using cURL from my ubuntu machine to merely GET from a remote machine, I seem unable to resolve the hostname and just get a Proxy Issue - The proxy has encountered an error (Error 21: Server Hostname Not Found) when running:

curl remotehostname

However, I am able to ping both remotehostname and it's ip address, and using curl on just the ip address works fine, e.g. curl 1.2.3.4.

I even tried a java program that uses the ApacheHttpClient implementation of the Jersey Client, and that worked fine too.

Is there a particular reason why cURL is unable to interpret remotehostname when everything else seems able to? I imagine it is a proxy related issue but as far as I can tell my proxy is set up fine seeing as everything else seems to work, just not cURL.

Quetzalcoatl

Posted 2013-04-11T11:42:11.487

Reputation: 111

Answers

0

Try using the follow redirects option. curl -L remotehostname (the "L" is capitalised). To check if this is a problem with your proxy, and not just the url you are downloading from, test a different url to see if you get the same error.

Craft1n3ss

Posted 2013-04-11T11:42:11.487

Reputation: 67

0

A little too late I guess, but I've had a similar issue and this worked for me:

curl -4 remotehostname

This option tells curl to resolve names to IPv4 addresses only.

Monitoring the packets with wireshark, I saw that curl was trying to resolve the hostname to an IPV6 address, which was not possible.

Hope it works for you too, good luck.

Claudiu

Posted 2013-04-11T11:42:11.487

Reputation: 465