curl-and-python

Re: How to fully customize the Http request

From: Kjetil Jacobsen <kjetilja_at_gmail.com>
Date: Sun, 21 May 2006 09:16:57 +0200

indeed.

for requests like GET and POST, the proxy needs to know the full url
to be able to perform the actual request on behalf of the client if
e.g. the request result is not in the proxy cache.

CUSTOMREQUEST seems to be context sensitive in this respect, i.e.
whether to pass the full url to the request command as in the proxy
case, or parts of the url as in the non-proxy case.

regards,
    - kjetil

On 5/20/06, Mohamed Lrhazi <lrhazi_at_gmail.com> wrote:
> 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
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2006-05-21