cURL / Mailing Lists / curl-library / Single Mail

curl-library

proxy problems

From: Russ Freeman <russf_at_gipsymedia.com>
Date: Tue, 24 Feb 2004 14:02:54 -0000

Hi,

 

First, I'd like to thank everyone that has worked on LibCurl to make it a
fabulous, simple and powerful tool. I contributed funds last time I had to
mess with LibCurl but this time I may be fixing a bug ;)

 

I'm not 100% sure what's going but I'll do my best to explain.

 

I've just upgraded my copy of libcurl to 7.11.0.

 

I'm testing against authenticating proxy servers ATM. I have a Squid proxy
and an ISA Server proxy. I'm testing HTTP POST.

 

When the post is sent we need to go through the authenticate phase. Having
stepped through the code it seems libcurl does a POST at the authenticate
phase with no content-length field in the header, and then it does the
real-deal POST after authentication. Squid doesn't like the first HTTP POST
because it doesn't have a content-length.

 

So in my client side POST code I added an explicit content-length (which is
wrong to do of course).squid was happy but ISA doesn't like the initial POST
with a bogus content-length because LibCurl doesn't send the data and ISA is
waiting for it.

 

So the "fix" is to add the content-length in the POST also during the
authentication phase. In http.c line 1458, function Curl_http(.) I change
the following code:

if(!authdone)

  /* until the auth is done, pretend we only do GET */

  httpreq = HTTPREQ_GET;

else

  httpreq = data->set.httpreq;

 

====to this instead:

if(!authdone)

{

  /* until the auth is done, pretend we only do GET */

  httpreq = HTTPREQ_GET;

 

  /*

    Add content length because some proxy servers don't like it without

  */

  if(!checkheaders(data, "Content-Length:"))

    add_bufferf(req_buffer, "Content-Length: 0\r\n");

}

else

{

  httpreq = data->set.httpreq;

}

 

I must admit I don't know much about proxy server handling or HTTP in
general. However, this fixes the problem with the initial GET sent to squid.

 

Any comments on this? Can this change be incorporated?

Regards
Russ Freeman

t: 01395 272555
f: 01395 272555
e: <mailto:russf_at_gipsymedia.com> russf_at_gipsymedia.com

=================
 <http://www.digiguide.com/> http://www.digiguide.com/ - World's best
interactive TV guide
 <http://www.mydigiguide.com/> http://www.mydigiguide.com/ - The world's
best online TV guide
 <http://library.digiguide.com/> http://library.digiguide.com/ - Massive
free resource of TV information

 
Received on 2004-02-24