cURL / Mailing Lists / curl-library / Single Mail

curl-library

py-curl

From: David Thiel <dthiel_at_nexprise.com>
Date: Fri, 1 Mar 2002 11:00:14 -0800

I'm trying to write a website testing program in python, but I'm seeing
some discrepancies in how curl and libcurl behave. Any guidance would
be appreciated.

Here's a short version of the offending bits, pretty simple:

url = "https://foo.com/LogIn?name=bob&password=johnson"
curl = pycurl.init()
curl.setopt(pycurl.URL, url)
curl.setopt(pycurl.FOLLOWLOCATION, 1)
curl.setopt(pycurl.WRITEFUNCTION, search)
curl.perform()
curl.cleanup()

The way this site authenticates, it just accepts the parameters
given in the url and sets a cookie. When I try to access the site
using curl -L https://blah, it logs in properly and returns the
proper page. When I use this libcurl bit, if I give it the
*improper* name and password, it returns the login failure
page, but when trying the correct one, it only displays the
regular login page, with no success or failure. So it looks
like there's a problem with either accepting the cookie sent,
or the redirect that happens shortly after login.

So I guess the question is, what is the correct way to use
libcurl to achieve the exact same results as one would with
curl -L?

Thanks much,
David
Received on 2002-03-01