nysus has asked for the wisdom of the Perl Monks concerning the following question:

I'm attempting to pass the user name and password to apache with WWW::Mechanize::Chrome to my router: $mech->get('http://admin:password@10.0.0.1/DEV_control.htm');

Sometimes it will work, more often it will not. I have tried it with and without WMC's sync setting turned on. It didn't make a different. I don't see any other obvious way of filling out the username and password with $mech as the form does not appear on the html page. Is there anything else I can try?

Update: Problem is actually worse than I imagined. $mech is basically cut off from my program. I can't even navigate away from the page.

UPDATE, with solution: Out of sheer luck, I discovered that shortening the password from 20 characters down to 10 solved the problem.

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks

Replies are listed 'Best First'.
Re: Using WWW::Mechanize::Chrome to log into content restricted by apache
by marto (Cardinal) on Apr 06, 2019 at 18:43 UTC

    Does this actually work if you do it manually with Chrome? Apparently:

    Use of the format "user:password" in the userinfo field is deprecated. Applications should not render as clear text any data after the first colon (":") character found within a userinfo subcomponent unless the data after the colon is the empty string (indicating no password). Applications may choose to ignore or reject such data when it is received as part of a reference and should reject the storage of such data in unencrypted form. The passing of authentication information in clear text has proven to b +e a security risk in almost every case where it has been used.

    Update: Also this.

      I'm using Chromium. Yeah it doesn't work in Chromium if I enter that URL directly into the address bar. But what's weird is if I try with WMC and then refresh the browser manually, it does, in fact log me in. I can't even do that if I manually type in the url.

      $PM = "Perl Monk's";
      $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
      $nysus = $PM . ' ' . $MCF;
      Click here if you love Perl Monks