RE: proxy authentication.

I haven't really played with proxies yet, but the proxy flag in the
'Basic' authentication structure should do the trick. I didn't want
interactive authentication and I did the following:

// Declaration and constructor for authentication information.
typedef struct _MYBasic {		  /* Basic challenge and
credentials */
  char *	uid;
  char *	pw;
  BOOL	retry;			    /* Should we ask the user again? */
  BOOL	proxy;			    /* Proxy authentication */
} MYBasic;

PRIVATE MYBasic * MYBasic_new(char * username, char* password)
{
  MYBasic * me = NULL;
  if ((me = (MYBasic *) HT_CALLOC(1, sizeof(MYBasic))) == NULL)
    HT_OUTOFMEM("MYBasic_new");
  me->uid = strdup(username); 
  me->pw = strdup(password); 
  me->retry = NO; 
  me->proxy = NO; 
  return me;
}

And in my www_request function,

  // Structure holding authentication info
  MYBasic * basic;

  HTAlert_setInteractive(NO);

  /* Automatic Authentication */
  if (username && password) {
    basic = MYBasic_new(username,password);
    HTBasic_generate (request, basic, 0);
  }

Try setting the proxy flag to YES and see what you get. I don't remember
why I had to set it to NO...

Christopher

> -----Original Message-----
> From: sbel@newmail.ru [mailto:sbel@newmail.ru]
> Sent: Friday, August 22, 2003 4:16 PM
> To: www-lib@w3.org
> Cc: sagar@cse.iitb.ac.in
> Subject: Re: proxy authentication.
> 
> 
> 
> 
> >I am behind a proxy and have been trying to do >proxy authentication
for
> >a long time. but cant get the program access >webpages.
> >I have tried doing HTProxy_add. But donot know >how to do the
> >authentication part.
> >I have also tried setting the http_proxy >environment variable, but
the
> >program does not ask for user-name, password for >the proxy.
> 
> Hello!
> 
> I've revealed the same problem when have tried to apply to proxy
> authentication in my programm.
> 
> For my application I use RedHat Linux 9 (2.4.20), for compilation -
gcc
> 3.2.2. Library installed from w3c-libwww-5.4.0-4.i386.rpm.
> 
> In main function I do the next calls:
> 
> ...
> HTProfile_newNoCacheClient(APP_NAME, APP_VERSION);
> ...
> HTProxy_add( "http", MY_PROXY );
> HTNoProxy_add( "localhost", NULL, 0 );
> 
> HTAlert_deleteOpcode( HT_A_USER_PW );
> HTAlert_add( PromptUsernameAndPassword, HT_A_USER_PW );
> 
> HTAlert_setInteractive( YES );
> ...
> 
> Then I apply to requested web resource.
> After that:
> HTEventList_loop(...);
> 
> End of main function.
> 
> So when I try to get some resource abroad proxy (www.hotmail.com e.g.)
-
> application, after receiving "407: Proxy Authentication required",
hunging
> up on call HTEventList_loop(...).
> 
> When I apply to "http://localhost" (no proxy) - I receive from my
local
> apache server authentication request. After inputing of authentication
> information I get html page and application ends.
> By other words - without proxy everything works fine.
> 
> So what's wrong?
> Does anybody already revealed such a problem and  know what to do?
> 
> Thanx in advance.
> Sergey.
> 
> 
> 
> 
> 

Received on Monday, 25 August 2003 02:42:19 UTC