Re: How to set the authorization header ?

Timo.Ross@ic3s.de wrote:
> 
> Hi all!
> 
> I want to set the authorization header with username / password, but I do
> not realy know how! Can any body help ???
> 
> Thanks in advance ...
> Timo!

Hi Timo,

One low-level way of setting authentication is by setting
the credentials on an HTRequest yourself doing things like:

HTRequest_addCredentials(request, "Authorization", "Basic ...");

where you might send a Basic credential with the username and password
Base64 
encoded... 

but perhaps the more natural way is for you to simply 
override the username and password callback so that you simply
supply the username and password and let libwww handle the proper
Basic or Digest encoding of the response from any server-side
Authentication
challenge.

You can setup your own callback for username and password requests
using:

    HTAlert_add(MyPrompt, HT_A_PROMPT);
    HTAlert_add(MyPromptPassword, HT_A_SECRET);
    HTAlert_add(MyPromptUsernameAndPassword, HT_A_USER_PW);

where the My... functions would handle your supplying of any prompts.
By default you may notice a simple stdin interface is supplied on Unix.

Look at the code in HTDialog.c where the default implementations
for the prompt callback functions exist. In your libwww client you can
setup
your own callback functions and then handle username and password
prompts with a GUI
dialog for instance...

Hope this helps
Jeff

Received on Friday, 9 March 2001 12:10:06 UTC