cURL / Mailing Lists / curl-library / Single Mail

curl-library

Implementing HTTP authentication

From: Lyndon Hill <emptystate_at_yahoo.co.uk>
Date: Tue, 18 May 2010 19:59:47 +0000 (GMT)

Hi

I want to add HTTP authentication to my application. This is
probably very naive:

1. Set CURLOPT_FAILONERROR to 1
2. Try to get the URL
3. Check CURLINFO_RESPONSE_CODE for a 401
4. If it was 401 then prompt the user for username and password
5. Store those details for the next time this URL is required

I have two questions,
Is this the right approach ?
and
Are there some recommendations for storing the username and password ?

I am not aware of a centralised password storage system in Linux; I was
thinking I could use OpenSSL to encrypt the information but some users
won't have it installed, furthermore anyone could read my source code to
find the key anyway so it is only a delaying tactic.

Many thanks in advance.

      

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-05-18