cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How does curl-lib deal with authentication?

From: Jeff Pohlmeyer <yetanothergeek_at_gmail.com>
Date: Tue, 13 Jan 2009 02:18:19 -0600

On Jan 13, 2009, Peter Spierenburg wrote:

> is there a mechanism that I can use to establish a callback
> function to ask the user for their credentials?

Once upon a time there was such a function, but it was removed
several years ago. You can read a short mention of it here:
http://curl.haxx.se/lxr/source/CHANGES.0#L6221

If you know in advance that an operation will require some
credentials, your program can ask the user for them before
you start the transfer, and pass that information on to the
libcurl CURLOPT_USERPWD option.

But if you're not sure whether or not a particular operation
needs credentials, then try it without them and if you get
an "Authorization Required" response, then you'll know to
prompt the user and try again.

 - Jeff
Received on 2009-01-13