cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Proxy authentication with CONNECT_ONLY option.

From: Praks <praks_123_at_fastmail.fm>
Date: Wed, 05 Jul 2006 07:29:57 +0300

Hi

Thanks for the responses. The point that CONNECT_ONLY need not do proxy authentication is correct. But I am looking to develop an application where in my HTTP client has to connect to a server across a proxy (with authentication) and then give me the handler so that I send further TCP data to that socket and hence this requirement. I tried to incorporate the fix that was suggested, but I get a compliation error for "data->state.authdone", which states that the field "authdone" is not part of the structure "Urlstate". Anyways, I would try to workaround it(Hope I am not doing anything wrong here).

Also, if I try <supplying the auth credentials at the first "non CONNECT ONLY">, then the server closes the connection once my first transaction is done.

PS: I have not got a complete handle of the Curl code yet. Apologize if there is anything silly in my questions :-)

Thanks.

-Prakash

> >
> On Tue, 4 Jul 2006, Praks wrote:
>
> > I am trying to develop a sample HTTP client application on Cygwin using
> > curl-7.15.3.
> >
> > I have used CONNECT_ONLY option in curl and i m trying to fetch a page
> > via proxy with authentication. It doesn't seem to work. On analyzing, using
> > a packet sniffer i found that the proxy authentication credentials are not
> > supplied.
>
> Yes, I just checked the sources and it seems the code for CONNECT_ONLY is
> too
> naive and won't do right.
>
> A quick attempt at a fix would be this:
>
> diff -u -r1.301 transfer.c
> --- lib/transfer.c 22 Jun 2006 21:36:54 -0000 1.301
> +++ lib/transfer.c 4 Jul 2006 11:15:26 -0000
> @@ -2223,7 +2223,7 @@
>
> if(res == CURLE_OK) {
> bool do_done;
> - if(data->set.connect_only) {
> + if(data->set.connect_only && data->state.authdone) {
> /* keep connection open for application to use the socket */
> conn->bits.close = FALSE;
> res = Curl_done(&conn, CURLE_OK);
>
>>
> Thinking about it, I'm not sure CONNECT_ONLY really should do proxy
> authentication. After all, it is *connect* only. Authentication is a
> whole lot
> more than just connecting...

Maybe supplying the auth credentials at the first "non CONNECT ONLY"
> action would be wise. Or adding a CONNECT_AND_AUTHENTICATE_ONLY option so
> that users choose when to authenticate against the Proxy ?
>
> Phil

-- 
  Praks
  praks_123_at_fastmail.fm
-- 
http://www.fastmail.fm - One of many happy users:
  http://www.fastmail.fm/docs/quotes.html
Received on 2006-07-05