curl-and-python

Re: How to fully customize the Http request

From: Mohamed Lrhazi <lrhazi_at_gmail.com>
Date: Sat, 20 May 2006 00:42:31 -0400

It just hit me, while reading the source, that curl would use the full
url for path if I was using PROXY... so I tried and it seems to just
work!

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

Is this right?
Mohamed~

On 5/19/06, Mohamed Lrhazi <lrhazi_at_gmail.com> wrote:
> Hello,
>
> This is not pycurl specific really, but i just happen to be trying
> curl from Python.
>
> I need to send a custom HTTP request, PURGE request to Squid proxy
> servers. I tried this:
>
> c = pycurl.Curl()
> purge_url='http://yahoo.com/index.html'
> c.setopt(c.URL, 'http://10.0.4.2/%s'%purge_url)
> c.setopt(c.CUSTOMREQUEST,'PURGE')
>
> This CURL sent:
>
> DEBUG: 2 PURGE /http://yaqb.org/test-cache/test.html HTTP/1.1
>
> Notice the slash at the begining of the path part.
>
> How do I go about making it send my url as is?
>
> Thanks a lot.
>
> Mohamed~
>

-- 
``We have now sunk to a depth at which restatement of the obvious is
the first duty of intelligent men.''
-George Orwell
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2006-05-20