Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Item14198: do not crash when the URI does not contain a userinfo part
PublishPlugin would abort with the following error:

***  ERROR: Main.AdminGroup not published: Can't locate object method "userinfo" via package "URI::_generic" at /usr/share/perl5/URI/WithBase.pm line 52.

Probably related to Item13444
  • Loading branch information
fschlich committed Nov 2, 2016
1 parent 830a54f commit 219f796
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/lib/Foswiki/Net.pm
Expand Up @@ -212,15 +212,15 @@ sub getExternalResource {
$uri->scheme( $puri->scheme() );
$uri->host( $puri->host() );
$uri->port( $puri->port() );
if ( $puri->userinfo() ) {
if ( $puri->can("userinfo") && defined $puri->userinfo() ) {
require MIME::Base64;
my $base64 =
MIME::Base64::encode_base64( $puri->userinfo(), '' );
$req .= "Proxy-Authorization: Basic $base64\r\n";
}
}

if ( $uri->userinfo() ) {
if ( $uri->can("userinfo") && defined $uri->userinfo() ) {
require MIME::Base64;
my $base64 = MIME::Base64::encode_base64( $uri->userinfo(), '' );
$req .= "Authorization: Basic $base64\r\n";
Expand Down Expand Up @@ -308,7 +308,7 @@ sub _GETUsingLWP {
my $user;
my $pass;
( $user, $pass ) = split( ':', $uri->userinfo(), 2 )
if ( $uri->userinfo() );
if ( $uri->can("userinfo") && defined $uri->userinfo() );
my $ua = new Foswiki::Net::UserCredAgent( $user, $pass );
$ua->proxy( [ 'http', 'https' ], $puri->as_string() ) if $puri;
my $response = $ua->request($request);
Expand Down

0 comments on commit 219f796

Please sign in to comment.