Imported Upstream version 6.19 upstream/6.19
authorDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 21 Jul 2022 02:28:21 +0000 (11:28 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 21 Jul 2022 02:28:21 +0000 (11:28 +0900)
24 files changed:
Changes
META.json
META.yml
bin/lwp-download
bin/lwp-dump
bin/lwp-mirror
bin/lwp-request
lib/LWP.pm
lib/LWP/Authen/Ntlm.pm
lib/LWP/ConnCache.pm
lib/LWP/Protocol.pm
lib/LWP/Protocol/cpan.pm
lib/LWP/Protocol/data.pm
lib/LWP/Protocol/file.pm
lib/LWP/Protocol/ftp.pm
lib/LWP/Protocol/gopher.pm
lib/LWP/Protocol/http.pm
lib/LWP/Protocol/loopback.pm
lib/LWP/Protocol/mailto.pm
lib/LWP/Protocol/nntp.pm
lib/LWP/Protocol/nogo.pm
lib/LWP/RobotUA.pm
lib/LWP/Simple.pm
lib/LWP/UserAgent.pm

diff --git a/Changes b/Changes
index 80d8a644e8db0c4e688fc6e2b1d4efa8d9e85d86..8b97544aac26e8e7f8977ac304e828124d527934 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,13 @@
 Change history for libwww-perl
 
-6.18   2017-02-02
+6.19    2017-02-14
+    - Call HTTP::Status constant functions without & (GH#110)
+    - Make bin scripts use LWP's version and not maintain their own (PR #54)
+    - Fix bug triggered in some cases of auth challenges not having a viable
+      protocol (PR#111)
+    - Remove usage of the 'vars' pragma (GH#113)
+
+6.18   2017-02-03
     - Update "timeout" when reusing sockets (PR#90)
     - Fix bug triggered when calling simple_request() with a malformed URL
       (PR#108)
index e442dfe77684d4cdb2a02f3e5e8c39bdeda7ca78..08dca690b862506de55e7fbd741fd58a16f8ecbf 100644 (file)
--- a/META.json
+++ b/META.json
@@ -4,7 +4,7 @@
       "Gisle Aas <gisle@activestate.com>"
    ],
    "dynamic_config" : 0,
-   "generated_by" : "ExtUtils::MakeMaker version 7.1001, CPAN::Meta::Converter version 2.150005",
+   "generated_by" : "ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150005",
    "license" : [
       "perl_5"
    ],
@@ -90,7 +90,7 @@
       "x_IRC" : "irc://irc.perl.org/#lwp",
       "x_MailingList" : "mailto:libwww@perl.org"
    },
-   "version" : "6.18",
+   "version" : "6.19",
    "x_authority" : "cpan:LWWWP",
    "x_serialization_backend" : "JSON::PP version 2.27300"
 }
index 6677f229c40ad764e843c97d6dbff38ee52ecc55..2b65e924f91272243d3208d85cbe81f6fb02fedb 100644 (file)
--- a/META.yml
+++ b/META.yml
@@ -13,7 +13,7 @@ configure_requires:
   File::Copy: '0'
   Getopt::Long: '0'
 dynamic_config: 0
-generated_by: 'ExtUtils::MakeMaker version 7.1001, CPAN::Meta::Converter version 2.150005'
+generated_by: 'ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150005'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -55,6 +55,6 @@ resources:
   MailingList: mailto:libwww@perl.org
   bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=libwww-perl
   repository: https://github.com/libwww-perl/libwww-perl.git
-version: '6.18'
+version: '6.19'
 x_authority: cpan:LWWWP
 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
index 648e367e81196c253e9d25535a22e5b2fa20048d..1686bbbe28f832fa4274a011d749459ed2fa94ee 100755 (executable)
@@ -79,10 +79,9 @@ unless (getopts('as', \%opt)) {
 my $url = URI->new(decode(locale => shift) || usage());
 my $argfile = encode(locale_fs => decode(locale => shift));
 usage() if defined($argfile) && !length($argfile);
-my $VERSION = "6.18";
 
 my $ua = LWP::UserAgent->new(
-   agent => "lwp-download/$VERSION ",
+   agent => "lwp-download/$LWP::UserAgent::VERSION ",
    keep_alive => 1,
    env_proxy => 1,
 );
index 6bcbda39d9c2a879cfe8b46477546a88ddb0a7b0..02458418bd7ba20cfa13e775ec0a8a57bcbc01ed 100755 (executable)
@@ -6,8 +6,6 @@ use Getopt::Long qw(GetOptions);
 use Encode;
 use Encode::Locale;
 
-my $VERSION = "6.18";
-
 GetOptions(\my %opt,
     'parse-head',
     'max-length=n',
@@ -40,7 +38,7 @@ my $ua = LWP::UserAgent->new(
     parse_head => $opt{'parse-head'} || 0,
     keep_alive => 1,
     env_proxy => 1,
-    agent => $opt{agent} || "lwp-dump/$VERSION ",
+    agent => $opt{agent} || "lwp-dump/$LWP::UserAgent::VERSION ",
 );
 
 my $req = HTTP::Request->new($opt{method} || 'GET' => decode(locale => $url));
index 712e1c0b9239f1efd11f32cd657f995cc76a4c09..51c6d3be2fa50a47e9883b603388400d5cf36f6f 100755 (executable)
@@ -47,8 +47,6 @@ $progname = $0;
 $progname =~ s,.*/,,;  # use basename only
 $progname =~ s/\.\w*$//; #strip extension if any
 
-$VERSION = "6.18";
-
 $opt_h = undef;  # print usage
 $opt_v = undef;  # print version
 $opt_t = undef;  # timeout
@@ -61,7 +59,7 @@ if ($opt_v) {
     require LWP;
     my $DISTNAME = 'libwww-perl-' . LWP::Version();
     die <<"EOT";
-This is lwp-mirror version $VERSION ($DISTNAME)
+This is lwp-mirror version $LWP::Simple::VERSION ($DISTNAME)
 
 Copyright 1995-1999, Gisle Aas.
 
index c072238769c9365818eec37fe6559f6b7ae0dd9c..87fb838204d4844ae39f23b1f733783035f71f55 100755 (executable)
@@ -184,9 +184,6 @@ $progname = $0;
 $progname =~ s,.*[\\/],,;  # use basename only
 $progname =~ s/\.\w*$//;   # strip extension, if any
 
-$VERSION = "6.18";
-
-
 require LWP;
 
 use URI;
@@ -225,7 +222,7 @@ use HTTP::Date qw(time2str str2time);
     sub new
     {
        my $self = LWP::UserAgent::new(@_);
-       $self->agent("lwp-request/$main::VERSION ");
+       $self->agent("lwp-request/$LWP::VERSION ");
        $self;
     }
 
@@ -296,7 +293,7 @@ if ($options{'v'}) {
     require LWP;
     my $DISTNAME = 'libwww-perl-' . LWP::Version();
     die <<"EOT";
-This is lwp-request version $VERSION ($DISTNAME)
+This is lwp-request version $LWP::VERSION ($DISTNAME)
 
 Copyright 1995-1999, Gisle Aas.
 
index 281d37c871f7937c1efd49cea36c7681c592c40c..2a87dfc12ad951c7e3770ef007b4bb23406eccdb 100644 (file)
@@ -1,6 +1,7 @@
 package LWP;
 
-our $VERSION = '6.18';
+our $VERSION = '6.19';
+
 sub Version { $VERSION; }
 
 require 5.008;
index 04b143e5f02d7eb39f6ff09df3cea5a7a8592ca5..8f14c5a490681f755a63404d037ff30753298cd3 100644 (file)
@@ -2,7 +2,7 @@ package LWP::Authen::Ntlm;
 
 use strict;
 
-our $VERSION = '6.18';
+our $VERSION = '6.19';
 
 use Authen::NTLM "1.02";
 use MIME::Base64 "2.12";
index 3c4ff3b9e4158e3e745d7b239caa8d45d8517f21..9c81d4b7411f27666ad028d33661039b764df1de 100644 (file)
@@ -1,10 +1,9 @@
 package LWP::ConnCache;
 
 use strict;
-use vars qw($DEBUG);
-
-our $VERSION = '6.18';
 
+our $VERSION = '6.19';
+our $DEBUG;
 
 sub new {
     my($class, %cnf) = @_;
index 442b9851e5c309ae5def45f7dcaf00228c9ac4fe..476a4a2b8b3ee3be7955466b1d4efc758793d340 100644 (file)
@@ -2,7 +2,7 @@ package LWP::Protocol;
 
 use base 'LWP::MemberMixin';
 
-our $VERSION = '6.18';
+our $VERSION = '6.19';
 
 use strict;
 use Carp ();
index 66d8f213b988d122992c7cab6964bd7c7f505989..aaf89917bb16a05f88bd3551d421ad722a4abb7c 100644 (file)
@@ -1,10 +1,8 @@
 package LWP::Protocol::cpan;
 
 use strict;
-use vars qw(@ISA);
 
-require LWP::Protocol;
-@ISA = qw(LWP::Protocol);
+use base qw(LWP::Protocol);
 
 require URI;
 require HTTP::Status;
@@ -49,14 +47,14 @@ sub request {
     # check proxy
     if (defined $proxy)
     {
-       return HTTP::Response->new(&HTTP::Status::RC_BAD_REQUEST,
+       return HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
                                   'You can not proxy with cpan');
     }
 
     # check method
     my $method = $request->method;
     unless ($method eq 'GET' || $method eq 'HEAD') {
-       return HTTP::Response->new(&HTTP::Status::RC_BAD_REQUEST,
+       return HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
                                   'Library does not allow method ' .
                                   "$method for 'cpan:' URLs");
     }
@@ -64,7 +62,7 @@ sub request {
     my $path = $request->uri->path;
     $path =~ s,^/,,;
 
-    my $response = HTTP::Response->new(&HTTP::Status::RC_FOUND);
+    my $response = HTTP::Response->new(HTTP::Status::RC_FOUND);
     $response->header("Location" => URI->new_abs($path, $CPAN));
     $response;
 }
index c29c3b4f919f61607a1c093bbc530ee44dc73b5c..419e3d6f53af2189c0162c10c8c88cfbeef54dbe 100644 (file)
@@ -3,13 +3,11 @@ package LWP::Protocol::data;
 # Implements access to data:-URLs as specified in RFC 2397
 
 use strict;
-use vars qw(@ISA);
 
 require HTTP::Response;
 require HTTP::Status;
 
-require LWP::Protocol;
-@ISA = qw(LWP::Protocol);
+use base qw(LWP::Protocol);
 
 use HTTP::Date qw(time2str);
 require LWP;  # needs version number
@@ -21,20 +19,20 @@ sub request
     # check proxy
     if (defined $proxy)
     {
-       return HTTP::Response->new( &HTTP::Status::RC_BAD_REQUEST,
+       return HTTP::Response->new( HTTP::Status::RC_BAD_REQUEST,
                                  'You can not proxy with data');
     }
 
     # check method
     my $method = $request->method;
     unless ($method eq 'GET' || $method eq 'HEAD') {
-       return HTTP::Response->new( &HTTP::Status::RC_BAD_REQUEST,
+       return HTTP::Response->new( HTTP::Status::RC_BAD_REQUEST,
                                  'Library does not allow method ' .
                                  "$method for 'data:' URLs");
     }
 
     my $url = $request->uri;
-    my $response = HTTP::Response->new( &HTTP::Status::RC_OK, "Document follows");
+    my $response = HTTP::Response->new( HTTP::Status::RC_OK, "Document follows");
 
     my $media_type = $url->media_type;
 
index f2887f4b2f37a0561de4c9c63854cf543a514d8e..5cea46c9595471c97bb958b13b845ce969996570 100644 (file)
@@ -1,7 +1,6 @@
 package LWP::Protocol::file;
 
-require LWP::Protocol;
-@ISA = qw(LWP::Protocol);
+use base qw(LWP::Protocol);
 
 use strict;
 
@@ -21,14 +20,14 @@ sub request
     # check proxy
     if (defined $proxy)
     {
-       return HTTP::Response->new( &HTTP::Status::RC_BAD_REQUEST,
+       return HTTP::Response->new( HTTP::Status::RC_BAD_REQUEST,
                                  'You can not proxy through the filesystem');
     }
 
     # check method
     my $method = $request->method;
     unless ($method eq 'GET' || $method eq 'HEAD') {
-       return HTTP::Response->new( &HTTP::Status::RC_BAD_REQUEST,
+       return HTTP::Response->new( HTTP::Status::RC_BAD_REQUEST,
                                  'Library does not allow method ' .
                                  "$method for 'file:' URLs");
     }
@@ -38,7 +37,7 @@ sub request
 
     my $scheme = $url->scheme;
     if ($scheme ne 'file') {
-       return HTTP::Response->new( &HTTP::Status::RC_INTERNAL_SERVER_ERROR,
+       return HTTP::Response->new( HTTP::Status::RC_INTERNAL_SERVER_ERROR,
                           "LWP::Protocol::file::request called for '$scheme'");
     }
 
@@ -47,11 +46,11 @@ sub request
 
     # test file exists and is readable
     unless (-e $path) {
-       return HTTP::Response->new( &HTTP::Status::RC_NOT_FOUND,
+       return HTTP::Response->new( HTTP::Status::RC_NOT_FOUND,
                                  "File `$path' does not exist");
     }
     unless (-r _) {
-       return HTTP::Response->new( &HTTP::Status::RC_FORBIDDEN,
+       return HTTP::Response->new( HTTP::Status::RC_FORBIDDEN,
                                  'User does not have read permission');
     }
 
@@ -67,13 +66,13 @@ sub request
     if (defined $ims) {
        my $time = HTTP::Date::str2time($ims);
        if (defined $time and $time >= $mtime) {
-           return HTTP::Response->new( &HTTP::Status::RC_NOT_MODIFIED,
+           return HTTP::Response->new( HTTP::Status::RC_NOT_MODIFIED,
                                      "$method $path");
        }
     }
 
     # Ok, should be an OK response by now...
-    my $response = HTTP::Response->new( &HTTP::Status::RC_OK );
+    my $response = HTTP::Response->new( HTTP::Status::RC_OK );
 
     # fill in response headers
     $response->header('Last-Modified', HTTP::Date::time2str($mtime));
@@ -81,7 +80,7 @@ sub request
     if (-d _) {         # If the path is a directory, process it
        # generate the HTML for directory
        opendir(D, $path) or
-          return HTTP::Response->new( &HTTP::Status::RC_INTERNAL_SERVER_ERROR,
+          return HTTP::Response->new( HTTP::Status::RC_INTERNAL_SERVER_ERROR,
                                     "Cannot read directory '$path': $!");
        my(@files) = sort readdir(D);
        closedir(D);
@@ -128,7 +127,7 @@ sub request
     # read the file
     if ($method ne "HEAD") {
        open(F, $path) or return new
-           HTTP::Response(&HTTP::Status::RC_INTERNAL_SERVER_ERROR,
+           HTTP::Response(HTTP::Status::RC_INTERNAL_SERVER_ERROR,
                           "Cannot read file '$path': $!");
        binmode(F);
        $response =  $self->collect($arg, $response, sub {
index f478c6ee732408ee48f4d3123c2c0e3c3179572a..69e53d4485c659cfed1af8317fcad1dd4adac55f 100644 (file)
@@ -11,8 +11,7 @@ use HTTP::Response ();
 use LWP::MediaTypes ();
 use File::Listing ();
 
-require LWP::Protocol;
-@ISA = qw(LWP::Protocol);
+use base qw(LWP::Protocol);
 
 use strict;
 eval {
@@ -21,8 +20,7 @@ eval {
     require Net::FTP;
     Net::FTP->require_version(2.00);
 
-    use vars qw(@ISA);
-    @ISA=qw(Net::FTP);
+    use base qw(Net::FTP);
 
     sub new {
        my $class = shift;
@@ -99,14 +97,14 @@ sub _connect {
     # XXX Should be some what to pass on 'Passive' (header??)
     unless ($ftp) {
        $@ =~ s/^Net::FTP: //;
-       return HTTP::Response->new(&HTTP::Status::RC_INTERNAL_SERVER_ERROR, $@);
+       return HTTP::Response->new(HTTP::Status::RC_INTERNAL_SERVER_ERROR, $@);
     }
 
     unless ($ftp->login($user, $password, $account)) {
        # Unauthorized.  Let's fake a RC_UNAUTHORIZED response
        my $mess = scalar($ftp->message);
        $mess =~ s/\n$//;
-       my $res =  HTTP::Response->new(&HTTP::Status::RC_UNAUTHORIZED, $mess);
+       my $res =  HTTP::Response->new(HTTP::Status::RC_UNAUTHORIZED, $mess);
        $res->header("Server", $ftp->http_server);
        $res->header("WWW-Authenticate", qq(Basic Realm="FTP login"));
        return $res;
@@ -130,14 +128,14 @@ sub request
     # check proxy
     if (defined $proxy)
     {
-       return HTTP::Response->new(&HTTP::Status::RC_BAD_REQUEST,
+       return HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
                                   'You can not proxy through the ftp');
     }
 
     my $url = $request->uri;
     if ($url->scheme ne 'ftp') {
        my $scheme = $url->scheme;
-       return HTTP::Response->new(&HTTP::Status::RC_INTERNAL_SERVER_ERROR,
+       return HTTP::Response->new(HTTP::Status::RC_INTERNAL_SERVER_ERROR,
                       "LWP::Protocol::ftp::request called for '$scheme'");
     }
 
@@ -145,13 +143,13 @@ sub request
     my $method = $request->method;
 
     unless ($method eq 'GET' || $method eq 'HEAD' || $method eq 'PUT') {
-       return HTTP::Response->new(&HTTP::Status::RC_BAD_REQUEST,
+       return HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
                                   'Library does not allow method ' .
                                   "$method for 'ftp:' URLs");
     }
 
     if ($init_failed) {
-       return HTTP::Response->new(&HTTP::Status::RC_INTERNAL_SERVER_ERROR,
+       return HTTP::Response->new(HTTP::Status::RC_INTERNAL_SERVER_ERROR,
                                   $init_failed);
     }
 
@@ -177,7 +175,7 @@ sub request
     return $ftp if ref($ftp) eq "HTTP::Response"; # ugh!
 
     # Create an initial response object
-    my $response = HTTP::Response->new(&HTTP::Status::RC_OK, "OK");
+    my $response = HTTP::Response->new(HTTP::Status::RC_OK, "OK");
     $response->header(Server => $ftp->http_server);
     $response->header('Client-Request-Num' => $ftp->request_count);
     $response->request($request);
@@ -205,7 +203,7 @@ sub request
 
     for (@path) {
        unless ($ftp->cwd($_)) {
-           return HTTP::Response->new(&HTTP::Status::RC_NOT_FOUND,
+           return HTTP::Response->new(HTTP::Status::RC_NOT_FOUND,
                                       "Can't chdir to $_");
        }
     }
@@ -215,14 +213,14 @@ sub request
            $response->last_modified($mod_time);
            if (my $ims = $request->if_modified_since) {
                if ($mod_time <= $ims) {
-                   $response->code(&HTTP::Status::RC_NOT_MODIFIED);
+                   $response->code(HTTP::Status::RC_NOT_MODIFIED);
                    $response->message("Not modified");
                    return $response;
                }
            }
        }
 
-       # We'll use this later to abort the transfer if necessary. 
+       # We'll use this later to abort the transfer if necessary.
        # if $max_size is defined, we need to abort early. Otherwise, it's
       # a normal transfer
        my $max_size = undef;
@@ -249,13 +247,13 @@ sub request
                }
                else {
 
-                 return HTTP::Response->new(&HTTP::Status::RC_BAD_REQUEST,
+                 return HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
                     'Incorrect syntax for Range request');
                }
        }
        elsif ($request->header('Range') && !$ftp->supported('REST'))
        {
-               return HTTP::Response->new(&HTTP::Status::RC_NOT_IMPLEMENTED,
+               return HTTP::Response->new(HTTP::Status::RC_NOT_IMPLEMENTED,
                 "Server does not support resume.");
        }
 
@@ -313,7 +311,7 @@ sub request
                # responses to abort() with code 0 in case of HEAD as ok
                # (at least wu-ftpd 2.6.1(1) does that).
                if ($method ne 'HEAD' || $ftp->code != 0) {
-                   $response->code(&HTTP::Status::RC_INTERNAL_SERVER_ERROR);
+                   $response->code(HTTP::Status::RC_INTERNAL_SERVER_ERROR);
                    $response->message("FTP close response: " . $ftp->code .
                                       " " . $ftp->message);
                }
@@ -322,7 +320,7 @@ sub request
        elsif (!length($remote_file) || ( $ftp->code >= 400 && $ftp->code < 600 )) {
            # not a plain file, try to list instead
            if (length($remote_file) && !$ftp->cwd($remote_file)) {
-               return HTTP::Response->new(&HTTP::Status::RC_NOT_FOUND,
+               return HTTP::Response->new(HTTP::Status::RC_NOT_FOUND,
                                           "File '$remote_file' not found");
            }
 
@@ -342,7 +340,7 @@ sub request
            my $content = '';
 
            if (!defined($prefer)) {
-               return HTTP::Response->new(&HTTP::Status::RC_NOT_ACCEPTABLE,
+               return HTTP::Response->new(HTTP::Status::RC_NOT_ACCEPTABLE,
                               "Neither HTML nor directory listing wanted");
            }
            elsif ($prefer eq 'html') {
@@ -373,7 +371,7 @@ sub request
            }
        }
        else {
-           my $res = HTTP::Response->new(&HTTP::Status::RC_BAD_REQUEST,
+           my $res = HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
                          "FTP return code " . $ftp->code);
            $res->content_type("text/plain");
            $res->content($ftp->message);
@@ -383,7 +381,7 @@ sub request
     elsif ($method eq 'PUT') {
        # method must be PUT
        unless (length($remote_file)) {
-           return HTTP::Response->new(&HTTP::Status::RC_BAD_REQUEST,
+           return HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
                                       "Must have a file name to PUT to");
        }
        my $data;
@@ -413,13 +411,13 @@ sub request
            }
            $data->close;
 
-           $response->code(&HTTP::Status::RC_CREATED);
+           $response->code(HTTP::Status::RC_CREATED);
            $response->header('Content-Type', 'text/plain');
            $response->content("$bytes bytes stored as $remote_file on $host\n")
 
        }
        else {
-           my $res = HTTP::Response->new(&HTTP::Status::RC_BAD_REQUEST,
+           my $res = HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
                                          "FTP return code " . $ftp->code);
            $res->content_type("text/plain");
            $res->content($ftp->message);
@@ -427,7 +425,7 @@ sub request
        }
     }
     else {
-       return HTTP::Response->new(&HTTP::Status::RC_BAD_REQUEST,
+       return HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
                                   "Illegal method $method");
     }
 
index db6c0bfba9dc4d1e624b25155f83416e02e73742..db3dcf10790bed00222848eab588ed2e70e5aa04 100644 (file)
@@ -8,15 +8,13 @@ package LWP::Protocol::gopher;
 # including contributions from Marc van Heyningen and Martijn Koster.
 
 use strict;
-use vars qw(@ISA);
 
 require HTTP::Response;
 require HTTP::Status;
 require IO::Socket;
 require IO::Select;
 
-require LWP::Protocol;
-@ISA = qw(LWP::Protocol);
+use base qw(LWP::Protocol);
 
 
 my %gopher2mimetype = (
@@ -47,7 +45,7 @@ sub request
 
     # check proxy
     if (defined $proxy) {
-       return HTTP::Response->new(&HTTP::Status::RC_BAD_REQUEST,
+       return HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
                                   'You can not proxy through the gopher');
     }
 
@@ -57,19 +55,19 @@ sub request
 
     my $method = $request->method;
     unless ($method eq 'GET' || $method eq 'HEAD') {
-       return HTTP::Response->new(&HTTP::Status::RC_BAD_REQUEST,
+       return HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
                                   'Library does not allow method ' .
                                   "$method for 'gopher:' URLs");
     }
 
     my $gophertype = $url->gopher_type;
     unless (exists $gopher2mimetype{$gophertype}) {
-       return HTTP::Response->new(&HTTP::Status::RC_NOT_IMPLEMENTED,
+       return HTTP::Response->new(HTTP::Status::RC_NOT_IMPLEMENTED,
                                   'Library does not support gophertype ' .
                                   $gophertype);
     }
 
-    my $response = HTTP::Response->new(&HTTP::Status::RC_OK, "OK");
+    my $response = HTTP::Response->new(HTTP::Status::RC_OK, "OK");
     $response->header('Content-type' => $gopher2mimetype{$gophertype}
                                        || 'text/plain');
     $response->header('Content-Encoding' => $gopher2encoding{$gophertype})
@@ -80,7 +78,7 @@ sub request
        $response->header('Client-Warning' => 'Client answer only');
        return $response;
     }
-    
+
     if ($gophertype eq '7' && ! $url->search) {
       # the url is the prompt for a gopher search; supply boiler-plate
       return $self->collect_once($arg, $response, <<"EOT");
index c0c6a093e0c0ab9b60dc3174163759c60ea46557..00beda954a2de076e40916bdffa4e6e4f7bf8781 100644 (file)
@@ -6,11 +6,9 @@ require HTTP::Response;
 require HTTP::Status;
 require Net::HTTP;
 
-use vars qw(@ISA @EXTRA_SOCK_OPTS);
-
-require LWP::Protocol;
-@ISA = qw(LWP::Protocol);
+use base qw(LWP::Protocol);
 
+our @EXTRA_SOCK_OPTS;
 my $CRLF = "\015\012";
 
 sub _new_socket
@@ -132,7 +130,7 @@ sub request
     # check method
     my $method = $request->method;
     unless ($method =~ /^[A-Za-z0-9_!\#\$%&\'*+\-.^\`|~]+$/) {  # HTTP token
-       return HTTP::Response->new( &HTTP::Status::RC_BAD_REQUEST,
+       return HTTP::Response->new( HTTP::Status::RC_BAD_REQUEST,
                                  'Library does not allow method ' .
                                  "$method for 'http:' URLs");
     }
@@ -513,7 +511,6 @@ sub increment_response_count {
 
 #-----------------------------------------------------------
 package LWP::Protocol::http::Socket;
-use vars qw(@ISA);
-@ISA = qw(LWP::Protocol::http::SocketMethods Net::HTTP);
+use base qw(LWP::Protocol::http::SocketMethods Net::HTTP);
 
 1;
index 2cd67ae36087a16ecd6fcc57233eefae4f9fc9c5..bcd7565c83b083965112d7f52a40df647d5e28fe 100644 (file)
@@ -1,11 +1,9 @@
 package LWP::Protocol::loopback;
 
 use strict;
-use vars qw(@ISA);
 require HTTP::Response;
 
-require LWP::Protocol;
-@ISA = qw(LWP::Protocol);
+use base qw(LWP::Protocol);
 
 sub request {
     my($self, $request, $proxy, $arg, $size, $timeout) = @_;
index 46db7162e449b659800d9b13b7c85f60e18bef5f..df568c16aa7b8c2eedde74010fedcf9c9458f3bb 100644 (file)
@@ -4,16 +4,15 @@ package LWP::Protocol::mailto;
 # frontend to the Unix sendmail program except on MacOS, where it uses
 # Mail::Internet.
 
-require LWP::Protocol;
 require HTTP::Request;
 require HTTP::Response;
 require HTTP::Status;
 
 use Carp;
 use strict;
-use vars qw(@ISA $SENDMAIL);
 
-@ISA = qw(LWP::Protocol);
+use base qw(LWP::Protocol);
+our $SENDMAIL;
 
 unless ($SENDMAIL = $ENV{SENDMAIL}) {
     for my $sm (qw(/usr/sbin/sendmail
@@ -39,7 +38,7 @@ sub request
     # check proxy
     if (defined $proxy)
     {
-       return HTTP::Response->new(&HTTP::Status::RC_BAD_REQUEST,
+       return HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
                                  'You can not proxy with mail');
     }
 
@@ -47,7 +46,7 @@ sub request
     my $method = $request->method;
 
     if ($method ne 'POST') {
-       return HTTP::Response->new( &HTTP::Status::RC_BAD_REQUEST,
+       return HTTP::Response->new( HTTP::Status::RC_BAD_REQUEST,
                                  'Library does not allow method ' .
                                  "$method for 'mailto:' URLs");
     }
@@ -57,7 +56,7 @@ sub request
 
     my $scheme = $url->scheme;
     if ($scheme ne 'mailto') {
-       return HTTP::Response->new( &HTTP::Status::RC_INTERNAL_SERVER_ERROR,
+       return HTTP::Response->new( HTTP::Status::RC_INTERNAL_SERVER_ERROR,
                         "LWP::Protocol::mailto::request called for '$scheme'");
     }
     if ($^O eq "MacOS") {
@@ -65,28 +64,28 @@ sub request
            require Mail::Internet;
        };
        if($@) {
-           return HTTP::Response->new( &HTTP::Status::RC_INTERNAL_SERVER_ERROR,
+           return HTTP::Response->new( HTTP::Status::RC_INTERNAL_SERVER_ERROR,
                       "You don't have MailTools installed");
        }
        unless ($ENV{SMTPHOSTS}) {
-           return HTTP::Response->new( &HTTP::Status::RC_INTERNAL_SERVER_ERROR,
+           return HTTP::Response->new( HTTP::Status::RC_INTERNAL_SERVER_ERROR,
                       "You don't have SMTPHOSTS defined");
        }
     }
     else {
        unless (-x $SENDMAIL) {
-           return HTTP::Response->new( &HTTP::Status::RC_INTERNAL_SERVER_ERROR,
+           return HTTP::Response->new( HTTP::Status::RC_INTERNAL_SERVER_ERROR,
                       "You don't have $SENDMAIL");
     }
     }
     if ($^O eq "MacOS") {
            $mail = Mail::Internet->new or
-           return HTTP::Response->new( &HTTP::Status::RC_INTERNAL_SERVER_ERROR,
+           return HTTP::Response->new( HTTP::Status::RC_INTERNAL_SERVER_ERROR,
            "Can't get a Mail::Internet object");
     }
     else {
        open(SENDMAIL, "| $SENDMAIL -oi -t") or
-           return HTTP::Response->new( &HTTP::Status::RC_INTERNAL_SERVER_ERROR,
+           return HTTP::Response->new( HTTP::Status::RC_INTERNAL_SERVER_ERROR,
                       "Can't run $SENDMAIL: $!");
     }
     if ($^O eq "MacOS") {
@@ -151,20 +150,20 @@ sub request
     if ($^O eq "MacOS") {
        $mail->body(\@text);
        unless ($mail->smtpsend) {
-           return HTTP::Response->new(&HTTP::Status::RC_INTERNAL_SERVER_ERROR,
+           return HTTP::Response->new(HTTP::Status::RC_INTERNAL_SERVER_ERROR,
                                       "Mail::Internet->smtpsend unable to send message to <$addr>");
        }
     }
     else {
        unless (close(SENDMAIL)) {
            my $err = $! ? "$!" : "Exit status $?";
-           return HTTP::Response->new(&HTTP::Status::RC_INTERNAL_SERVER_ERROR,
+           return HTTP::Response->new(HTTP::Status::RC_INTERNAL_SERVER_ERROR,
                                       "$SENDMAIL: $err");
        }
     }
 
 
-    my $response = HTTP::Response->new(&HTTP::Status::RC_ACCEPTED,
+    my $response = HTTP::Response->new(HTTP::Status::RC_ACCEPTED,
                                       "Mail accepted");
     $response->header('Content-Type', 'text/plain');
     if ($^O eq "MacOS") {
index 788477d488a741185505651e7191aec61927d6f0..56f792a8bdc71b14e77bb6b12d1ddafc25797801 100644 (file)
@@ -2,8 +2,7 @@ package LWP::Protocol::nntp;
 
 # Implementation of the Network News Transfer Protocol (RFC 977)
 
-require LWP::Protocol;
-@ISA = qw(LWP::Protocol);
+use base qw(LWP::Protocol);
 
 require HTTP::Response;
 require HTTP::Status;
@@ -20,7 +19,7 @@ sub request
 
     # Check for proxy
     if (defined $proxy) {
-       return HTTP::Response->new(&HTTP::Status::RC_BAD_REQUEST,
+       return HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
                                   'You can not proxy through NNTP');
     }
 
@@ -28,14 +27,14 @@ sub request
     my $url = $request->uri;
     my $scheme = $url->scheme;
     unless ($scheme eq 'news' || $scheme eq 'nntp') {
-       return HTTP::Response->new(&HTTP::Status::RC_INTERNAL_SERVER_ERROR,
+       return HTTP::Response->new(HTTP::Status::RC_INTERNAL_SERVER_ERROR,
                                   "LWP::Protocol::nntp::request called for '$scheme'");
     }
 
     # check for a valid method
     my $method = $request->method;
     unless ($method eq 'GET' || $method eq 'HEAD' || $method eq 'POST') {
-       return HTTP::Response->new(&HTTP::Status::RC_BAD_REQUEST,
+       return HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
                                   'Library does not allow method ' .
                                   "$method for '$scheme:' URLs");
     }
@@ -45,7 +44,7 @@ sub request
     my $is_art = $groupart =~ /@/;
 
     if ($is_art && $method eq 'POST') {
-       return HTTP::Response->new(&HTTP::Status::RC_BAD_REQUEST,
+       return HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
                                   "Can't post to an article <$groupart>");
     }
 
@@ -58,10 +57,10 @@ sub request
 
     # Check the initial welcome message from the NNTP server
     if ($nntp->status != 2) {
-       return HTTP::Response->new(&HTTP::Status::RC_SERVICE_UNAVAILABLE,
+       return HTTP::Response->new(HTTP::Status::RC_SERVICE_UNAVAILABLE,
                                   $nntp->message);
     }
-    my $response = HTTP::Response->new(&HTTP::Status::RC_OK, "OK");
+    my $response = HTTP::Response->new(HTTP::Status::RC_OK, "OK");
 
     my $mess = $nntp->message;
 
@@ -75,7 +74,7 @@ sub request
     # First we handle posting of articles
     if ($method eq 'POST') {
        $nntp->quit; $nntp = undef;
-       $response->code(&HTTP::Status::RC_NOT_IMPLEMENTED);
+       $response->code(HTTP::Status::RC_NOT_IMPLEMENTED);
        $response->message("POST not implemented yet");
        return $response;
     }
@@ -83,13 +82,13 @@ sub request
     # The method must be "GET" or "HEAD" by now
     if (!$is_art) {
        if (!$nntp->group($groupart)) {
-           $response->code(&HTTP::Status::RC_NOT_FOUND);
+           $response->code(HTTP::Status::RC_NOT_FOUND);
            $response->message($nntp->message);
        }
        $nntp->quit; $nntp = undef;
        # HEAD: just check if the group exists
        if ($method eq 'GET' && $response->is_success) {
-           $response->code(&HTTP::Status::RC_NOT_IMPLEMENTED);
+           $response->code(HTTP::Status::RC_NOT_IMPLEMENTED);
            $response->message("GET newsgroup not implemented yet");
        }
        return $response;
@@ -100,7 +99,7 @@ sub request
     my $art = $nntp->$get("<$groupart>");
     unless ($art) {
        $nntp->quit; $nntp = undef;
-       $response->code(&HTTP::Status::RC_NOT_FOUND);
+       $response->code(HTTP::Status::RC_NOT_FOUND);
        $response->message($nntp->message);
        return $response;
     }
index 68150a722d5eea55f6ff45e187cf7cfbab5e86aa..2a54672e7a4ae132fcbbac7994f017f7a39fa816 100644 (file)
@@ -6,18 +6,17 @@ package LWP::Protocol::nogo;
 # a 500 error.
 
 use strict;
-use vars qw(@ISA);
+
 require HTTP::Response;
 require HTTP::Status;
-require LWP::Protocol;
-@ISA = qw(LWP::Protocol);
+use base qw(LWP::Protocol);
 
 sub request {
     my($self, $request) = @_;
     my $scheme = $request->uri->scheme;
-    
+
     return HTTP::Response->new(
-      &HTTP::Status::RC_INTERNAL_SERVER_ERROR,
+      HTTP::Status::RC_INTERNAL_SERVER_ERROR,
       "Access to \'$scheme\' URIs has been disabled"
     );
 }
index 6149c4cd9fb39990b606c410fedcc369390c408b..755b75fd1f2613df2f3e98c38b8142bb6c796294 100644 (file)
@@ -1,7 +1,8 @@
 package LWP::RobotUA;
 
 use base qw(LWP::UserAgent);
-our $VERSION = '6.18';
+
+our $VERSION = '6.19';
 
 require WWW::RobotRules;
 require HTTP::Request;
@@ -143,7 +144,7 @@ sub simple_request
     # Check rules
     unless ($allowed) {
        my $res = HTTP::Response->new(
-         &HTTP::Status::RC_FORBIDDEN, 'Forbidden by robots.txt');
+         HTTP::Status::RC_FORBIDDEN, 'Forbidden by robots.txt');
        $res->request( $request ); # bind it to that request
        return $res;
     }
@@ -157,7 +158,7 @@ sub simple_request
        }
        else {
            my $res = HTTP::Response->new(
-             &HTTP::Status::RC_SERVICE_UNAVAILABLE, 'Please, slow down');
+             HTTP::Status::RC_SERVICE_UNAVAILABLE, 'Please, slow down');
            $res->header('Retry-After', time2str(time + $wait));
            $res->request( $request ); # bind it to that request
            return $res;
index bdbec95bafb7adf8cb5c91e8f1980d169a220f80..9ee2ff5c8a654ea969b7ecf57e5f6aac5b16a95a 100644 (file)
@@ -1,12 +1,13 @@
 package LWP::Simple;
 
 use strict;
-use vars qw($ua %loop_check $FULL_LWP @EXPORT @EXPORT_OK);
+
+our $VERSION = '6.19';
 
 require Exporter;
 
-@EXPORT = qw(get head getprint getstore mirror);
-@EXPORT_OK = qw($ua);
+our @EXPORT = qw(get head getprint getstore mirror);
+our @EXPORT_OK = qw($ua);
 
 # I really hate this.  It was a bad idea to do it in the first place.
 # Wonder how to get rid of it???  (It even makes LWP::Simple 7% slower
@@ -14,8 +15,6 @@ require Exporter;
 use HTTP::Status;
 push(@EXPORT, @HTTP::Status::EXPORT);
 
-our $VERSION = '6.18';
-
 sub import
 {
     my $pkg = shift;
@@ -24,13 +23,12 @@ sub import
 }
 
 use LWP::UserAgent ();
-use HTTP::Status ();
 use HTTP::Date ();
-$ua = LWP::UserAgent->new;  # we create a global UserAgent object
+
+our $ua = LWP::UserAgent->new;  # we create a global UserAgent object
 $ua->agent("LWP::Simple/$VERSION ");
 $ua->env_proxy;
 
-
 sub get ($)
 {
     my $response = $ua->get(shift);
index 2c2252dc0b90704e066f3708c4ada7bca7e1ad61..7780bf9bce20d219e21445f5ca7a23973380c145 100644 (file)
@@ -3,7 +3,6 @@ package LWP::UserAgent;
 use strict;
 
 use base qw(LWP::MemberMixin);
-our $VERSION = '6.18';
 
 use Carp ();
 use HTTP::Request ();
@@ -16,6 +15,7 @@ use LWP::Protocol ();
 use Scalar::Util qw(blessed);
 use Try::Tiny qw(try catch);
 
+our $VERSION = '6.19';
 
 sub new
 {
@@ -177,7 +177,7 @@ sub send_request
             catch {
                 my $error = $_;
                 $error =~ s/ at .* line \d+.*//s;  # remove file/line number
-                $response =  _new_response($request, &HTTP::Status::RC_NOT_IMPLEMENTED, $error);
+                $response =  _new_response($request, HTTP::Status::RC_NOT_IMPLEMENTED, $error);
                 if ($scheme eq "https") {
                     $response->message($response->message . " (LWP::Protocol::https not installed)");
                     $response->content_type("text/plain");
@@ -204,7 +204,7 @@ EOT
                     my $full = $error;
                     (my $status = $error) =~ s/\n.*//s;
                     $status =~ s/ at .* line \d+.*//s;  # remove file/line number
-                    my $code = ($status =~ s/^(\d\d\d)\s+//) ? $1 : &HTTP::Status::RC_INTERNAL_SERVER_ERROR;
+                    my $code = ($status =~ s/^(\d\d\d)\s+//) ? $1 : HTTP::Status::RC_INTERNAL_SERVER_ERROR;
                     $response = _new_response($request, $code, $status, $full);
                 }
             };
@@ -277,22 +277,22 @@ sub simple_request
     };
 
     if ($error) {
-        return _new_response($request, &HTTP::Status::RC_BAD_REQUEST, $error);
+        return _new_response($request, HTTP::Status::RC_BAD_REQUEST, $error);
     }
     return $self->send_request($request, $arg, $size);
 }
 
 
-sub request
-{
-    my($self, $request, $arg, $size, $previous) = @_;
+sub request {
+    my ($self, $request, $arg, $size, $previous) = @_;
 
     my $response = $self->simple_request($request, $arg, $size);
     $response->previous($previous) if $previous;
 
     if ($response->redirects >= $self->{max_redirect}) {
         $response->header("Client-Warning" =>
-                          "Redirect loop detected (max_redirect = $self->{max_redirect})");
+                "Redirect loop detected (max_redirect = $self->{max_redirect})"
+        );
         return $response;
     }
 
@@ -302,118 +302,121 @@ sub request
 
     my $code = $response->code;
 
-    if ($code == &HTTP::Status::RC_MOVED_PERMANENTLY or
-       $code == &HTTP::Status::RC_FOUND or
-       $code == &HTTP::Status::RC_SEE_OTHER or
-       $code == &HTTP::Status::RC_TEMPORARY_REDIRECT)
+    if (   $code == HTTP::Status::RC_MOVED_PERMANENTLY
+        or $code == HTTP::Status::RC_FOUND
+        or $code == HTTP::Status::RC_SEE_OTHER
+        or $code == HTTP::Status::RC_TEMPORARY_REDIRECT)
     {
-       my $referral = $request->clone;
-
-       # These headers should never be forwarded
-       $referral->remove_header('Host', 'Cookie');
-
-       if ($referral->header('Referer') &&
-           $request->uri->scheme eq 'https' &&
-           $referral->uri->scheme eq 'http')
-       {
-           # RFC 2616, section 15.1.3.
-           # https -> http redirect, suppressing Referer
-           $referral->remove_header('Referer');
-       }
+        my $referral = $request->clone;
+
+        # These headers should never be forwarded
+        $referral->remove_header('Host', 'Cookie');
 
-       if ($code == &HTTP::Status::RC_SEE_OTHER ||
-           $code == &HTTP::Status::RC_FOUND)
+        if (   $referral->header('Referer')
+            && $request->uri->scheme eq 'https'
+            && $referral->uri->scheme eq 'http')
         {
-           my $method = uc($referral->method);
-           unless ($method eq "GET" || $method eq "HEAD") {
-               $referral->method("GET");
-               $referral->content("");
-               $referral->remove_content_headers;
-           }
-       }
+            # RFC 2616, section 15.1.3.
+            # https -> http redirect, suppressing Referer
+            $referral->remove_header('Referer');
+        }
 
-       # And then we update the URL based on the Location:-header.
-       my $referral_uri = $response->header('Location');
-       {
-           # Some servers erroneously return a relative URL for redirects,
-           # so make it absolute if it not already is.
-           local $URI::ABS_ALLOW_RELATIVE_SCHEME = 1;
-           my $base = $response->base;
-           $referral_uri = "" unless defined $referral_uri;
-           $referral_uri = $HTTP::URI_CLASS->new($referral_uri, $base)
-                           ->abs($base);
-       }
-       $referral->uri($referral_uri);
+        if (   $code == HTTP::Status::RC_SEE_OTHER
+            || $code == HTTP::Status::RC_FOUND)
+        {
+            my $method = uc($referral->method);
+            unless ($method eq "GET" || $method eq "HEAD") {
+                $referral->method("GET");
+                $referral->content("");
+                $referral->remove_content_headers;
+            }
+        }
+
+        # And then we update the URL based on the Location:-header.
+        my $referral_uri = $response->header('Location');
+        {
+            # Some servers erroneously return a relative URL for redirects,
+            # so make it absolute if it not already is.
+            local $URI::ABS_ALLOW_RELATIVE_SCHEME = 1;
+            my $base = $response->base;
+            $referral_uri = "" unless defined $referral_uri;
+            $referral_uri
+                = $HTTP::URI_CLASS->new($referral_uri, $base)->abs($base);
+        }
+        $referral->uri($referral_uri);
 
-       return $response unless $self->redirect_ok($referral, $response);
-       return $self->request($referral, $arg, $size, $response);
+        return $response unless $self->redirect_ok($referral, $response);
+        return $self->request($referral, $arg, $size, $response);
 
     }
-    elsif ($code == &HTTP::Status::RC_UNAUTHORIZED ||
-            $code == &HTTP::Status::RC_PROXY_AUTHENTICATION_REQUIRED
-           )
+    elsif ($code == HTTP::Status::RC_UNAUTHORIZED
+        || $code == HTTP::Status::RC_PROXY_AUTHENTICATION_REQUIRED)
     {
-       my $proxy = ($code == &HTTP::Status::RC_PROXY_AUTHENTICATION_REQUIRED);
-       my $ch_header = $proxy || $request->method eq 'CONNECT'
-           ?  "Proxy-Authenticate" : "WWW-Authenticate";
-       my @challenge = $response->header($ch_header);
-       unless (@challenge) {
-           $response->header("Client-Warning" =>
-                             "Missing Authenticate header");
-           return $response;
-       }
+        my $proxy = ($code == HTTP::Status::RC_PROXY_AUTHENTICATION_REQUIRED);
+        my $ch_header
+            = $proxy || $request->method eq 'CONNECT'
+            ? "Proxy-Authenticate"
+            : "WWW-Authenticate";
+        my @challenges = $response->header($ch_header);
+        unless (@challenges) {
+            $response->header(
+                "Client-Warning" => "Missing Authenticate header");
+            return $response;
+        }
 
-       require HTTP::Headers::Util;
-       CHALLENGE: for my $challenge (@challenge) {
-           $challenge =~ tr/,/;/;  # "," is used to separate auth-params!!
-           ($challenge) = HTTP::Headers::Util::split_header_words($challenge);
-           my $scheme = shift(@$challenge);
-           shift(@$challenge); # no value
-           $challenge = { @$challenge };  # make rest into a hash
-
-           unless ($scheme =~ /^([a-z]+(?:-[a-z]+)*)$/) {
-               $response->header("Client-Warning" =>
-                                 "Bad authentication scheme '$scheme'");
-               return $response;
-           }
-           $scheme = $1;  # untainted now
-           my $class = "LWP::Authen::\u$scheme";
-           $class =~ s/-/_/g;
-
-           no strict 'refs';
-           unless (%{"$class\::"}) {
-               # try to load it
-        try {
-            (my $req = $class) =~ s{::}{/}g;
-            $req .= '.pm' unless $req =~ /\.pm$/;
-            require $req;
+        require HTTP::Headers::Util;
+        CHALLENGE: for my $challenge (@challenges) {
+            $challenge =~ tr/,/;/;    # "," is used to separate auth-params!!
+            ($challenge) = HTTP::Headers::Util::split_header_words($challenge);
+            my $scheme = shift(@$challenge);
+            shift(@$challenge);       # no value
+            $challenge = {@$challenge};    # make rest into a hash
+
+            unless ($scheme =~ /^([a-z]+(?:-[a-z]+)*)$/) {
+                $response->header(
+                    "Client-Warning" => "Bad authentication scheme '$scheme'");
+                return $response;
+            }
+            $scheme = $1;                  # untainted now
+            my $class = "LWP::Authen::\u$scheme";
+            $class =~ s/-/_/g;
+
+            no strict 'refs';
+            unless (%{"$class\::"}) {
+                # try to load it
+                my $error;
+                try {
+                    (my $req = $class) =~ s{::}{/}g;
+                    $req .= '.pm' unless $req =~ /\.pm$/;
+                    require $req;
+                }
+                catch {
+                    $error = $_;
+                };
+                if ($error) {
+                    if ($error =~ /^Can\'t locate/) {
+                        $response->header("Client-Warning" =>
+                                "Unsupported authentication scheme '$scheme'");
+                    }
+                    else {
+                        $response->header("Client-Warning" => $error);
+                    }
+                    next CHALLENGE;
+                }
+            }
+            unless ($class->can("authenticate")) {
+                $response->header("Client-Warning" =>
+                        "Unsupported authentication scheme '$scheme'");
+                next CHALLENGE;
+            }
+            return $class->authenticate($self, $proxy, $challenge, $response,
+                $request, $arg, $size);
         }
-        catch {
-            my $error = $_;
-                   if ($error =~ /^Can\'t locate/) {
-                       $response->header("Client-Warning" =>
-                                         "Unsupported authentication scheme '$scheme'");
-                   }
-                   else {
-                       $response->header("Client-Warning" => $error);
-                   }
-                   next CHALLENGE;
-               };
-           }
-           unless ($class->can("authenticate")) {
-               $response->header("Client-Warning" =>
-                                 "Unsupported authentication scheme '$scheme'");
-               next CHALLENGE;
-           }
-           return $class->authenticate($self, $proxy, $challenge, $response,
-                                       $request, $arg, $size);
-       }
-       return $response;
+        return $response;
     }
     return $response;
 }
 
-
 #
 # Now the shortcuts...
 #
@@ -776,7 +779,7 @@ sub default_header {
     return $self->default_headers->header(@_);
 }
 
-sub _agent       { "libwww-perl/$LWP::VERSION" }
+sub _agent { "libwww-perl/$VERSION" }
 
 sub agent {
     my $self = shift;