[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpclient-users
Subject:    Re: HTTP Error 400. The request hostname is invalid.
From:       Bill Gottlieb <bgottlieb () gawquest ! com>
Date:       2015-03-23 23:18:43
Message-ID: CANWfG0cKN8TUjCDbeYAxFaJiEfWEPF_-ot_56pBTA0chP2GJSw () mail ! gmail ! com
[Download RAW message or body]


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
>
>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic