Re: Sending Username and Password for HTTP PUT

This is a bit of a hack, but it may help.  Create an HTAlert callback for
HT_A_USER_PW.  It would look something like:

static BOOL
prompt_username_password(HTRequest *request, HTAlertOpcode op,
                         int msgnum, const char *dfault,
                         void *input, HTAlertPar *reply)
{
	HTAlert_setReplyMessage(reply, "the-username");
	HTAlert_setReplySecret(reply, "the-password");
	return YES;
}

/* and in your startup code: */

HTAlert_add(prompt_username_password, HT_A_USER_PW);


This should work with any of the protocols that require username/password
authentication.

James.

--
Email: james@daa.com.au
WWW:   http://www.daa.com.au/~james/


On Mon, 29 Nov 1999, Macomber, Jeff wrote:

> Hello,
> 
> I am trying to write some code that takes in the name of a file to retrieve
> from a web server and then connects and retrieves it to the hard drive
> (relatively simple).  I am trying to figure out how wwwlib handles username
> and passwords since I will need to log into the server to get at the file.
> Does anyone have some experience with doing this that wouldn't mind
> enlightening me?  
> 
> Thanks for your Time,
> 
> Jeff
> 
> > -----Original Message-----
> > From:	Henrik Frystyk Nielsen [SMTP:frystyk@microsoft.com]
> > Sent:	Thursday, November 04, 1999 1:46 PM
> > To:	Richard Krenek; www-lib@w3.org
> > Subject:	Re: HTPutDocumentAnchor on Windows
> > 
> > I bet it's the local file name that confused libwww - try and use
> > 
> >     HTLocalToWWW(...)
> > 
> > defined in
> > 
> >     http://www.w3.org/Library/src/HTWWWStr.html
> > 
> > to convert the local file name into a URI before using it in HTParse(...).
> > 
> > Henrik Frystyk Nielsen,
> > mailto:frystyk@microsoft.com
> > 
> > ----- Original Message -----
> > From: "Richard Krenek" <rkrenek@ihs.com>
> > To: <www-lib@w3.org>
> > Sent: Thursday 04 November, 1999 10:34
> > Subject: HTPutDocumentAnchor on Windows
> > 
> > 
> > > Hello All,
> > >     I'm trying to run the below command which keeps returning 'NO'. It
> > > works fine on a Unix platform
> > > but returns 'NO' when on windows.
> > >
> > > char * local_filename_to_send = "c:\\temp\\somefile.tif";
> > > char * full_src_str = HTParse(local_filename_to_send, cwd, PARSE_ALL);
> > > HTAnchor * src = src = HTAnchor_findAddress(full_src_str);
> > > HTAnchor_setLength(HTAnchor_parent(src), len);
> > > BOOL st = HTPutDocumentAnchor(HTAnchor_parent(src), dst, request);
> > >
> > > The dst is a valid URI and the file to send is valid. We tried the
> > > slashes in the file name as \\ and /, neither worked. Has anyone else
> > > had simular problems or know what I may be doing wrong or need to
> > > change? Anything would be helpful.
> > >
> > > Thanks,
> > > Richard Krenek
> > >
> 

Received on Monday, 29 November 1999 20:40:17 UTC