You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by wrxdude144 <st...@guideworkstv.com> on 2007/06/07 19:55:05 UTC

error resolving hostname

I am having a problem, and I am not sure how to diagnose it. I am not even
sure it is an HttpClient problem, but that's where it shows up. So here
goes...

If I use an IP address in my URL, everything works great. However, if I use
a hostname in place of the IP, the GetMethod request fails with a 404. But,
when I run the failing URL through wget, it works! I would have expected
wget to fail in the same manner as my HttpClient call. Why would wget work
and GetMethod fail?

I am running RH ES 4.4, Java 1.5.10, and HttpClient 3.0.

--Steve
-- 
View this message in context: http://www.nabble.com/error-resolving-hostname-tf3885345.html#a11013007
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


RE: error resolving hostname

Posted by Steve Terrell <St...@guideworkstv.com>.
I found the issue. Our hostname was using an underscore character. Valid
hostnames do not have underscores in them!:
http://en.wikipedia.org/wiki/Hostname (look for Restrictions on valid
host names)

   I still don't know why this worked with wget.

--Steve

-----Original Message-----
From: Roland Weber [mailto:ossfwot@dubioso.net] 
Sent: Thursday, June 07, 2007 2:54 PM
To: HttpClient User Discussion
Subject: Re: error resolving hostname

Hello Steve,

> If I use an IP address in my URL, everything works great. However, if
I use
> a hostname in place of the IP, the GetMethod request fails with a 404.
But,
> when I run the failing URL through wget, it works! I would have
expected
> wget to fail in the same manner as my HttpClient call. Why would wget
work
> and GetMethod fail?

404 is an error response from the server, which obviously doesn't
like something in the request. In HttpClient, you can enable wire
logging (for the headers) to see the exact request:
http://jakarta.apache.org/commons/httpclient/logging.html

Please compare the request being generated when you use the IP
address with the request when you use the hostname. Are you using
a plain hostname or a fully qualified one? Maybe you can also get
a trace of the request that wget sends? If you don't know how to
interpret the differences, please post traces of the requests to
this list. Then we'll take guesses :-)

hope that helps,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: error resolving hostname

Posted by Roland Weber <os...@dubioso.net>.
Hello Steve,

> If I use an IP address in my URL, everything works great. However, if I use
> a hostname in place of the IP, the GetMethod request fails with a 404. But,
> when I run the failing URL through wget, it works! I would have expected
> wget to fail in the same manner as my HttpClient call. Why would wget work
> and GetMethod fail?

404 is an error response from the server, which obviously doesn't
like something in the request. In HttpClient, you can enable wire
logging (for the headers) to see the exact request:
http://jakarta.apache.org/commons/httpclient/logging.html

Please compare the request being generated when you use the IP
address with the request when you use the hostname. Are you using
a plain hostname or a fully qualified one? Maybe you can also get
a trace of the request that wget sends? If you don't know how to
interpret the differences, please post traces of the requests to
this list. Then we'll take guesses :-)

hope that helps,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org