Can I do "Digest Authentification"

Dave Cragg dcragg at lacscentre.co.uk
Tue Nov 19 14:38:00 EST 2002


At 11:52 am -0500 19/11/02, RGould8 at aol.com wrote:
>In a message dated 11/19/02 11:38:15 AM, alex at mindlube.com writes:
>
>
>Rev does have a md5Digest() function. Using that you could encypt the
>username and password, and use libURLSetCustomHTTPHeaders() to
>configure the HTTP request to include the Username and Password with
>the http request. I haven't tried this, but it seems like it should
>work.
>
>
>
>This is perfect!  Exactly what I need to do.  I'm a bit leery of the
>learning curve in using libURLSetCustomHTTPHeaders() to configure an
>HTTP request.  I'll dig right in starting now - - - - curious though
>- - - can someone who has done this sort of thing share some of
>their samples, so I don't have to re-invent the wheel?  Any
>assistance is greatly appreciated.

I also haven't done this, but I think setting the httpHeaders will be 
easier than libURLSetCustomHTTPHeaders. libURLSetCustomHTTPHeaders 
replaces the default headers including the http request line (GET, 
POST, etc) so you have to build the complete request. Setting the 
httpHeaders just adds headers to the default set (replacing any that 
are duplicated).

The details of digest authorization can be found here:

http://ftp.ics.uci.edu/pub/ietf/http/rfc2617.txt

The header you need to set will look something like this:

Authorization: Digest (followed by various data including an 
md5Digest of the password)

It looks like you will need to convert the md5Digest output to a hex string.

The example Authorization header in the above doc splits the header 
over a number of lines. I think you will have to keep it on a single 
line when setting the httpHeaders otherwise libUrl may mess up. :(

Good luck!

Dave



More information about the use-livecode mailing list