Quantcast

[HTTPBuilder] Strange behaviour of auth.basic

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[HTTPBuilder] Strange behaviour of auth.basic

Nicolas Delsaux
Hi all,
so after trying to have a working log mechanism for the application I
work on, I finally changed my point of view and installed a http proxy
(Fiddler, in my case).
Using this proxy, I hav found with astonishment that the basic
authentifcation mechanism is used only once : on first connect.
Following connect attempts uses the same session, I guess.
Unfortunatly, the site I try to connect to does not seems to honor
sessions, requiring me to authenticate at each request.
How can I do that ?
Thanks.

--
Nicolas Delsaux

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [HTTPBuilder] Strange behaviour of auth.basic

Thom Nichols
Hi Nicolas,

Well, you can calculate the basic auth header yourself and put it into
the headers of every request like so:

def user = 'tom'
def pass = 'secret'

def http = new HTTPBuilder('http://myhost.com')
http.headers[ 'Authorization' ] =
"$user:$pass".getBytes('iso-8859-1').encodeBase64()

I don't know of a way to make HttpClient do so automatically.  It
supports preemptive auth:
http://hc.apache.org/httpcomponents-client/tutorial/html/authentication.html
But that still might not keep sending the auth header once the session
is established.

-Tom


On Tue, Feb 2, 2010 at 8:22 AM, Nicolas Delsaux
<[hidden email]> wrote:

> Hi all,
> so after trying to have a working log mechanism for the application I
> work on, I finally changed my point of view and installed a http proxy
> (Fiddler, in my case).
> Using this proxy, I hav found with astonishment that the basic
> authentifcation mechanism is used only once : on first connect.
> Following connect attempts uses the same session, I guess.
> Unfortunatly, the site I try to connect to does not seems to honor
> sessions, requiring me to authenticate at each request.
> How can I do that ?
> Thanks.
>
> --
> Nicolas Delsaux
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [HTTPBuilder] Strange behaviour of auth.basic

Nicolas Delsaux
On Tue, Feb 2, 2010 at 6:27 PM, Tom Nichols <[hidden email]> wrote:
>
>
> I don't know of a way to make HttpClient do so automatically.  It
> supports preemptive auth:
> http://hc.apache.org/httpcomponents-client/tutorial/html/authentication.html
> But that still might not keep sending the auth header once the session
> is established.
>
Well, to make long short, it works !
Thanks, Tom, you solved my bug !

--
Nicolas Delsaux

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Loading...