cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to fully customize the HTTP request

From: Mohamed Lrhazi <lrhazi_at_gmail.com>
Date: Sun, 21 May 2006 13:30:54 -0400

You're right maybe Squid does not support keep-alive for Proxying or
maybe for PURGE method....

I tried and it clearly opens a tcp connection per url:

netstat -an|grep '\.80'; python purge-curl.py; netstat -an|grep '\.80'
Testing libcurl/7.15.3 OpenSSL/0.9.8b zlib/1.1.4
HTTP_CONNECTCODE: 0
RESPONSE_CODE: 200
HTTP_CONNECTCODE: 0
RESPONSE_CODE: 404
HTTP_CONNECTCODE: 0
RESPONSE_CODE: 404

192.168.1.67.56072 10.0.4.2.80 6912 0 49640 0 TIME_WAIT
192.168.1.67.56073 10.0.4.2.80 6912 0 49640 0 TIME_WAIT
192.168.1.67.56074 10.0.4.2.80 6912 0 49640 0 TIME_WAIT

The code was:

purge_url='http://yaqb.org/test-cache/test.html'
c.setopt(c.PROXY,'10.0.4.2:80')
c.setopt(c.URL, purge_url)
c.setopt(c.CUSTOMREQUEST,'PURGE')
for i in range(3):
        c.perform()
        print 'HTTP_CONNECTCODE: %d'%c.getinfo(c.HTTP_CONNECTCODE)
        print 'RESPONSE_CODE: %d'%c.getinfo(c.RESPONSE_CODE)
        
c.close()

When I send normal GET request, the same script above, with PROXY
option, reports one and only one tcp:80 connection.

So, how do I go about getting a CURLOPT_CUSTOMPATH? where can I ask?
are you a cURL devolopper? I have not programmed in C for many years,
so I feel I should not be messing with the code...

Thanks,
Mohamed~

On 5/21/06, Alexander Lazic <al-curllibrary_at_none.at> wrote:
> On Son 21.05.2006 11:45, Mohamed Lrhazi wrote:
> >
> >Actually I cannot use the CURLOPT_PROXY workaround because It does not
> >seem to use KEEP-ALIVE... and I need KEEP-ALIVE because I have too much
> >PURGE requests to send....
>
> Does squid support keep-alive for the purge method?!
>
> I'am not very familiar with the python interface but how about this in
> pseudo-code:
>
> ---
> setopt(...)
> setopt(...)
> setopt(...)
>
> for i in urls;
>
> setopt(URL,$i);
> execute();
>
> fi
> ---
>
> In c/perl i would go this way.
>
> Regards
>
> Alex
>

-- 
``We have now sunk to a depth at which restatement of the obvious is
the first duty of intelligent men.''
-George Orwell
Received on 2006-05-21