Coder Social home page Coder Social logo

proxy basic auth about www-mechanize-chrome HOT 3 OPEN

corion avatar corion commented on June 29, 2024
proxy basic auth

from www-mechanize-chrome.

Comments (3)

Corion avatar Corion commented on June 29, 2024

I've never used basic auth with a proxy, but maybe try

launch_arg => ['--proxy-server=http://user:[email protected]']

... or try setting the HTTP_PROXY variable before launching Chrome:

$ENV{HTTP_PROXY} = 'http://user:[email protected]';
$ENV{HTTPS_PROXY} = 'http://user:[email protected]';

my $mech = WWW::Mechanize::Chrome->new(
    ...
    # launch_arg => []
);

from www-mechanize-chrome.

arahnale avatar arahnale commented on June 29, 2024

Thanks, but it didn’t work.
I managed to make authorization through:

launch_arg => ['--proxy-server=http://12.43.56.67:1234'],

...

$chrome->driver->send_packet('Fetch.enable' , 'handleAuthRequests' => JSON::true );

 my $asdf = $chrome->add_listener('Fetch.requestPaused', sub {
   my( $info ) = @_;
   my $requestId = $info->{'params'}{'requestId'};
   $chrome->driver->send_message('Fetch.continueRequest' , 'requestId' => $requestId);
 });

 my $asd = $chrome->add_listener('Fetch.authRequired', sub {
   my( $info ) = @_;
   my $requestId = $info->{'params'}{'requestId'};
   print "Fetch auth\n";
   my %auth = (
     'requestId' => $requestId ,
     "authChallengeResponse" => {"response" => "ProvideCredentials" , "username" => "my_user_name" , "password" => "my_password"});
     my $a = $chrome->driver->send_message('Fetch.continueWithAuth' , %auth);
   });

from www-mechanize-chrome.

skyhighpn avatar skyhighpn commented on June 29, 2024

@arahnale
I'm trying your code, and it should work from what I can tell, but the Fetch.authRequired just doesn't seem to trigger. It only triggers the Fetch.requestPaused. "Fetch pause" is all that is outputted with a proxy error in chromium. Any suggestions?

 my $asd = $mechtwo->add_listener('Fetch.authRequired', sub {
   my( $info ) = @_;
   print "Fetch auth\n";
   my $requestId = $info->{'params'}{'requestId'};
   my %auth = (
     'requestId' => $requestId ,
     "authChallengeResponse" => {"response" => "ProvideCredentials" , "username" => "" , "password" => ""});
     my $a = $mechtwo->target->send_message('Fetch.continueWithAuth' , %auth);
   });
 my $asdf = $mechtwo->add_listener('Fetch.requestPaused', sub {
   my( $info ) = @_;
   print "Fetch pause\n";
   my $requestId = $info->{'params'}{'requestId'};
  $mechtwo->target->send_message('Fetch.continueRequest' , 'requestId' => $requestId);
 });

from www-mechanize-chrome.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.