I think I saw some chatter on this a couple months back -- check the archives in early May or do a search for Authentication.
http://www.mail-archive.com/wtr-general%40rubyforge.org/ > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Danny > R. Faught > Sent: Friday, July 28, 2006 3:34 PM > To: [email protected] > Subject: [Wtr-general] simple solution for basic authentication > > Howdy folks. I find myself on a project where I want to use > a browser-based test tool to record client-side performance metrics. > After playing with several such tools again, Watir again > emerged as the tool that I was first able to get a working > script with. > > But along the way, I noticed with some amazement that Perl's > Win32::IE::Mechanize module was able to handle the basic HTTP > authentication that gives so many people headaches with other > tools. It doesn't do it by automating the dialog asking for > the login information, but rather it prevents the dialog from > appearing by submitting the credentials right from the > beginning. That means it makes one fewer transaction with > the web server (avoiding the first request that gets a 401 > response), but perhaps I can live with that. > > Has anyone else tried to implement this with Watir? If not I > may try it myself. Here's the core of it in IE::Mechanize > where it formulates the Authorization header, really simple stuff: > > sub __authorization_basic { > my( $user, $pass ) = @_; > defined $user && defined $pass or return; > > require MIME::Base64; > return "Authorization: Basic " . > MIME::Base64::encode_base64( "$user:$pass" ) . > "\015\012"; > } > _______________________________________________ > Wtr-general mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/wtr-general > The content contained in this electronic message is not intended to constitute formation of a contract binding TWTC. TWTC will be contractually bound only upon execution, by an authorized officer, of a contract including agreed terms and conditions or by express application of its tariffs. This message is intended only for the use of the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the sender of this E-Mail or by telephone. _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
