cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: User+Password validation?

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 6 May 2003 14:44:33 -0700

On Wed, May 07, 2003 at 01:46:16AM +0530, Naved Khan wrote:
> Hi,
>
> Many appologies if this question is very elementary.
>
> I have built a HTTPS wrapper over libcurl. I'm posting an XML request and
> displaying the returned headers, XML response, HTTPS code etc.
> I have a function called connect which is the first funtion called.
> int Connect(const char* szServer, const char* szUserID, const char* szPassword)
>
> Later, after all the options are set, char* GetResponse() is called which
> returns the XML response. This is the main function where curl_easy_perform is
> called for HTTPS post.
>
> I wanted to check if the server is valid in the Connect function defined above
> so I can return the error code(if any) immediately. Is there any way to do it?
> Just want to check if given user + password works for the given server. I'm
> looking into it also. Any help will be highy appreciated.

This is an entirely site-specific function; there's no generic way to do it.
If you can identify a safe password-protected page on the site (e.g. /), you
can do a complete HTTP transaction on that page using the HTTP HEAD command
and see if you get a success code. Unless you're calling GetResponse lots of
times for every Connect and you server supports keep-alive, you'll be
doubling the work for every useful transaction.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com
Received on 2003-05-07