hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Gottlieb <bgottl...@gawquest.com>
Subject Re: HTTP Error 400. The request hostname is invalid.
Date Mon, 23 Mar 2015 23:18:43 GMT
Yes, that was the issue.  Thank you for your help!

On Mon, Mar 23, 2015 at 1:02 PM, Oleg Kalnichevski <olegk@apache.org> wrote:

> On Mon, 2015-03-23 at 08:59 -0400, Bill Gottlieb wrote:
> > It appears that the authorization line must be causing the issue:
> >
> >
> > THIS WORKS:
> > 2015/03/23 08:48:05:580 EDT [DEBUG] headers - http-outgoing-0 >>
> > Authorization: Basic xxxxxBase64EncodedUserIDAndPasswordxxxxx
> > 2015/03/23 08:48:05:580 EDT [DEBUG] headers - http-outgoing-0 >> Host:
> > webapi.avertest.com
> > 2015/03/23 08:48:05:580 EDT [DEBUG] headers - http-outgoing-0 >>
> > Connection: Keep-Alive
> > 2015/03/23 08:48:05:580 EDT [DEBUG] headers - http-outgoing-0 >>
> > User-Agent: Apache-HttpClient/4.4 (Java 1.5 minimum; Java/1.6.0_45)
> > 2015/03/23 08:48:05:580 EDT [DEBUG] headers - http-outgoing-0 >>
> > Accept-Encoding: gzip,deflate
> > 2015/03/23 08:48:07:929 EDT [DEBUG] headers - http-outgoing-0 << HTTP/1.1
> > 200 OK
> >
> > THIS FAILS (Notice the extra line after the user id password):
> > 2015/03/23 05:11:05:491 EDT [DEBUG] headers - http-outgoing-0 >>
> > Authorization: Basic xxxxxBase64EncodedUserIDAndPasswordxxxxx
> >
> > 2015/03/23 05:11:05:491 EDT [DEBUG] headers - http-outgoing-0 >> Host:
> > webapi.avertest.com
> > 2015/03/23 05:11:05:492 EDT [DEBUG] headers - http-outgoing-0 >>
> > Connection: Keep-Alive
> > 2015/03/23 05:11:05:492 EDT [DEBUG] headers - http-outgoing-0 >>
> > User-Agent: Apache-HttpClient/4.4 (Java 1.5 minimum; Java/1.6.0)
> > 2015/03/23 05:11:05:492 EDT [DEBUG] headers - http-outgoing-0 >>
> > Accept-Encoding: gzip,deflate
> > 2015/03/23 05:11:05:549 EDT [DEBUG] headers - http-outgoing-0 << HTTP/1.1
> > 400 Bad Request
> >
> > Both do the same thing.  Why does one get the blank line after the Base64
> > encoded info?
> >
> > import org.apache.commons.codec.binary.Base64;
> > ...
> > String encoding = base64.encodeBase64String((userID + ":" +
> > password).getBytes());
> > ....
> > HttpGet get = new HttpGet(url);
> > get.setHeader("Authorization", "Basic " + encodedAuth);
> > ...
> >
> >
>
> Please see if you have the same version of Commons Codec on both
> systems.
>
> Oleg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message