diff options
author | Karl Berry <karl@freefriends.org> | 2015-04-26 22:16:26 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-04-26 22:16:26 +0000 |
commit | 342e672574c4e67d510e46ab6acd0e21a7d0cf54 (patch) | |
tree | 79e04202d08c0404bbd780bd26c1e34710e539b6 /Master/tlpkg/tlperl/lib/LWP | |
parent | be2706af7c57a0ef0f4d4e9f684ca4ef74922a82 (diff) |
(tl)perl 5.20.2 for windows, from siep
git-svn-id: svn://tug.org/texlive/trunk@37064 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl/lib/LWP')
-rw-r--r-- | Master/tlpkg/tlperl/lib/LWP/Authen/Ntlm.pm | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/LWP/ConnCache.pm | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/LWP/Protocol.pm | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/LWP/Protocol/http.pm | 16 | ||||
-rwxr-xr-x | Master/tlpkg/tlperl/lib/LWP/Protocol/https.pm | 211 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/LWP/RobotUA.pm | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/LWP/Simple.pm | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/LWP/UserAgent.pm | 6 |
8 files changed, 19 insertions, 224 deletions
diff --git a/Master/tlpkg/tlperl/lib/LWP/Authen/Ntlm.pm b/Master/tlpkg/tlperl/lib/LWP/Authen/Ntlm.pm index 9c1bbe3cbc1..2a571b75bcb 100644 --- a/Master/tlpkg/tlperl/lib/LWP/Authen/Ntlm.pm +++ b/Master/tlpkg/tlperl/lib/LWP/Authen/Ntlm.pm @@ -3,7 +3,7 @@ package LWP::Authen::Ntlm; use strict; use vars qw/$VERSION/; -$VERSION = "6.00"; +$VERSION = "6.13"; use Authen::NTLM "1.02"; use MIME::Base64 "2.12"; diff --git a/Master/tlpkg/tlperl/lib/LWP/ConnCache.pm b/Master/tlpkg/tlperl/lib/LWP/ConnCache.pm index fcc0b2e027d..4969ec5a4dc 100644 --- a/Master/tlpkg/tlperl/lib/LWP/ConnCache.pm +++ b/Master/tlpkg/tlperl/lib/LWP/ConnCache.pm @@ -3,7 +3,7 @@ package LWP::ConnCache; use strict; use vars qw($VERSION $DEBUG); -$VERSION = "6.02"; +$VERSION = "6.13"; sub new { diff --git a/Master/tlpkg/tlperl/lib/LWP/Protocol.pm b/Master/tlpkg/tlperl/lib/LWP/Protocol.pm index da2ba3edcfb..8f17d4db5fb 100644 --- a/Master/tlpkg/tlperl/lib/LWP/Protocol.pm +++ b/Master/tlpkg/tlperl/lib/LWP/Protocol.pm @@ -2,7 +2,7 @@ package LWP::Protocol; require LWP::MemberMixin; @ISA = qw(LWP::MemberMixin); -$VERSION = "6.06"; +$VERSION = "6.13"; use strict; use Carp (); diff --git a/Master/tlpkg/tlperl/lib/LWP/Protocol/http.pm b/Master/tlpkg/tlperl/lib/LWP/Protocol/http.pm index a75e147650a..23c361f7055 100644 --- a/Master/tlpkg/tlperl/lib/LWP/Protocol/http.pm +++ b/Master/tlpkg/tlperl/lib/LWP/Protocol/http.pm @@ -17,6 +17,12 @@ sub _new_socket { my($self, $host, $port, $timeout) = @_; + # IPv6 literal IP address should be [bracketed] to remove + # ambiguity between ip address and port number. + if ( ($host =~ /:/) && ($host !~ /^\[/) ) { + $host = "[$host]"; + } + local($^W) = 0; # IO::Socket::INET can be noisy my $sock = $self->socket_class->new(PeerAddr => $host, PeerPort => $port, @@ -276,7 +282,7 @@ sub request my $n = $socket->syswrite($req_buf, length($req_buf)); unless (defined $n) { redo WRITE if $!{EINTR}; - if ($!{EAGAIN}) { + if ($!{EWOULDBLOCK} || $!{EAGAIN}) { select(undef, undef, undef, 0.1); redo WRITE; } @@ -346,7 +352,7 @@ sub request { my $nfound = select($rbits, $wbits, undef, $sel_timeout); if ($nfound < 0) { - if ($!{EINTR} || $!{EAGAIN}) { + if ($!{EINTR} || $!{EWOULDBLOCK} || $!{EAGAIN}) { if ($time_before) { $sel_timeout = $sel_timeout_before - (time - $time_before); $sel_timeout = 0 if $sel_timeout < 0; @@ -367,7 +373,7 @@ sub request my $buf = $socket->_rbuf; my $n = $socket->sysread($buf, 1024, length($buf)); unless (defined $n) { - die "read failed: $!" unless $!{EINTR} || $!{EAGAIN}; + die "read failed: $!" unless $!{EINTR} || $!{EWOULDBLOCK} || $!{EAGAIN}; # if we get here the rest of the block will do nothing # and we will retry the read on the next round } @@ -398,7 +404,7 @@ sub request if (defined($wbits) && $wbits =~ /[^\0]/) { my $n = $socket->syswrite($$wbuf, length($$wbuf), $woffset); unless (defined $n) { - die "write failed: $!" unless $!{EINTR} || $!{EAGAIN}; + die "write failed: $!" unless $!{EINTR} || $!{EWOULDBLOCK} || $!{EAGAIN}; $n = 0; # will retry write on the next round } elsif ($n == 0) { @@ -455,7 +461,7 @@ sub request { $n = $socket->read_entity_body($buf, $size); unless (defined $n) { - redo READ if $!{EINTR} || $!{EAGAIN} || $!{ENOTTY}; + redo READ if $!{EINTR} || $!{EWOULDBLOCK} || $!{EAGAIN} || $!{ENOTTY}; die "read failed: $!"; } redo READ if $n == -1; diff --git a/Master/tlpkg/tlperl/lib/LWP/Protocol/https.pm b/Master/tlpkg/tlperl/lib/LWP/Protocol/https.pm deleted file mode 100755 index a707917a0a7..00000000000 --- a/Master/tlpkg/tlperl/lib/LWP/Protocol/https.pm +++ /dev/null @@ -1,211 +0,0 @@ -package LWP::Protocol::https; - -use strict; -our $VERSION = "6.06"; - -require LWP::Protocol::http; -our @ISA = qw(LWP::Protocol::http); -require Net::HTTPS; - -sub socket_type -{ - return "https"; -} - -sub _extra_sock_opts -{ - my $self = shift; - my %ssl_opts = %{$self->{ua}{ssl_opts} || {}}; - if (delete $ssl_opts{verify_hostname}) { - $ssl_opts{SSL_verify_mode} ||= 1; - $ssl_opts{SSL_verifycn_scheme} = 'www'; - } - else { - $ssl_opts{SSL_verify_mode} = 0; - } - if ($ssl_opts{SSL_verify_mode}) { - unless (exists $ssl_opts{SSL_ca_file} || exists $ssl_opts{SSL_ca_path}) { - eval { - require Mozilla::CA; - }; - if ($@) { - if ($@ =! /^Can't locate Mozilla\/CA\.pm/) { - $@ = <<'EOT'; -Can't verify SSL peers without knowing which Certificate Authorities to trust - -This problem can be fixed by either setting the PERL_LWP_SSL_CA_FILE -environment variable or by installing the Mozilla::CA module. - -To disable verification of SSL peers set the PERL_LWP_SSL_VERIFY_HOSTNAME -environment variable to 0. If you do this you can't be sure that you -communicate with the expected peer. -EOT - } - die $@; - } - $ssl_opts{SSL_ca_file} = Mozilla::CA::SSL_ca_file(); - } - } - $self->{ssl_opts} = \%ssl_opts; - return (%ssl_opts, $self->SUPER::_extra_sock_opts); -} - -#------------------------------------------------------------ -# _cn_match($common_name, $san_name) -# common_name: an IA5String -# san_name: subjectAltName -# initially we were only concerned with the dNSName -# and the 'left-most' only wildcard as noted in -# https://tools.ietf.org/html/rfc6125#section-6.4.3 -# this method does not match any wildcarding in the -# domain name as listed in section-6.4.3.3 -# -sub _cn_match { - my( $me, $common_name, $san_name ) = @_; - - # /CN has a '*.' prefix - # MUST be an FQDN -- fishing? - return 0 if( $common_name =~ /^\*\./ ); - - my $re = q{}; # empty string - - # turn a leading "*." into a regex - if( $san_name =~ /^\*\./ ) { - $san_name =~ s/\*//; - $re = "[^.]+"; - } - - # quotemeta the rest and match anchored - if( $common_name =~ /^$re\Q$san_name\E$/ ) { - return 1; - } - return 0; -} - -#------------------------------------------------------- -# _in_san( cn, cert ) -# 'cn' of the form /CN=host_to_check ( "Common Name" form ) -# 'cert' any object that implements a peer_certificate('subjectAltNames') method -# which will return an array of ( type-id, value ) pairings per -# http://tools.ietf.org/html/rfc5280#section-4.2.1.6 -# if there is no subjectAltNames there is nothing more to do. -# currently we have a _cn_match() that will allow for simple compare. -sub _in_san -{ - my($me, $cn, $cert) = @_; - - # we can return early if there are no SAN options. - my @sans = $cert->peer_certificate('subjectAltNames'); - return unless scalar @sans; - - (my $common_name = $cn) =~ s/.*=//; # strip off the prefix. - - # get the ( type-id, value ) pairwise - # currently only the basic CN to san_name check - while( my ( $type_id, $value ) = splice( @sans, 0, 2 ) ) { - return 'ok' if $me->_cn_match($common_name,$value); - } - return; -} - -sub _check_sock -{ - my($self, $req, $sock) = @_; - my $check = $req->header("If-SSL-Cert-Subject"); - if (defined $check) { - my $cert = $sock->get_peer_certificate || - die "Missing SSL certificate"; - my $subject = $cert->subject_name; - unless ( $subject =~ /$check/ ) { - my $ok = $self->_in_san( $check, $cert); - die "Bad SSL certificate subject: '$subject' !~ /$check/" - unless $ok; - } - $req->remove_header("If-SSL-Cert-Subject"); # don't pass it on - } -} - -sub _get_sock_info -{ - my $self = shift; - $self->SUPER::_get_sock_info(@_); - my($res, $sock) = @_; - $res->header("Client-SSL-Cipher" => $sock->get_cipher); - my $cert = $sock->get_peer_certificate; - if ($cert) { - $res->header("Client-SSL-Cert-Subject" => $cert->subject_name); - $res->header("Client-SSL-Cert-Issuer" => $cert->issuer_name); - } - if (!$self->{ssl_opts}{SSL_verify_mode}) { - $res->push_header("Client-SSL-Warning" => "Peer certificate not verified"); - } - elsif (!$self->{ssl_opts}{SSL_verifycn_scheme}) { - $res->push_header("Client-SSL-Warning" => "Peer hostname match with certificate not verified"); - } - $res->header("Client-SSL-Socket-Class" => $Net::HTTPS::SSL_SOCKET_CLASS); -} - -# upgrade plain socket to SSL, used for CONNECT tunnel when proxying https -# will only work if the underlying socket class of Net::HTTPS is -# IO::Socket::SSL, but code will only be called in this case -if ( $Net::HTTPS::SSL_SOCKET_CLASS->can('start_SSL')) { - *_upgrade_sock = sub { - my ($self,$sock,$url) = @_; - $sock = LWP::Protocol::https::Socket->start_SSL( $sock, - SSL_verifycn_name => $url->host, - $self->_extra_sock_opts, - ); - $@ = LWP::Protocol::https::Socket->errstr if ! $sock; - return $sock; - } -} - -#----------------------------------------------------------- -package LWP::Protocol::https::Socket; - -our @ISA = qw(Net::HTTPS LWP::Protocol::http::SocketMethods); - -1; - -__END__ - -=head1 NAME - -LWP::Protocol::https - Provide https support for LWP::UserAgent - -=head1 SYNOPSIS - - use LWP::UserAgent; - - $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 1 }); - $res = $ua->get("https://www.example.com"); - -=head1 DESCRIPTION - -The LWP::Protocol::https module provides support for using https schemed -URLs with LWP. This module is a plug-in to the LWP protocol handling, so -you don't use it directly. Once the module is installed LWP is able -to access sites using HTTP over SSL/TLS. - -If hostname verification is requested by LWP::UserAgent's C<ssl_opts>, and -neither C<SSL_ca_file> nor C<SSL_ca_path> is set, then C<SSL_ca_file> is -implied to be the one provided by Mozilla::CA. If the Mozilla::CA module -isn't available SSL requests will fail. Either install this module, set up an -alternative C<SSL_ca_file> or disable hostname verification. - -This module used to be bundled with the libwww-perl, but it was unbundled in -v6.02 in order to be able to declare its dependencies properly for the CPAN -tool-chain. Applications that need https support can just declare their -dependency on LWP::Protocol::https and will no longer need to know what -underlying modules to install. - -=head1 SEE ALSO - -L<IO::Socket::SSL>, L<Crypt::SSLeay>, L<Mozilla::CA> - -=head1 COPYRIGHT - -Copyright 1997-2011 Gisle Aas. - -This library is free software; you can redistribute it and/or -modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/LWP/RobotUA.pm b/Master/tlpkg/tlperl/lib/LWP/RobotUA.pm index 79cb301e20e..7b6ab7e1ee7 100644 --- a/Master/tlpkg/tlperl/lib/LWP/RobotUA.pm +++ b/Master/tlpkg/tlperl/lib/LWP/RobotUA.pm @@ -2,7 +2,7 @@ package LWP::RobotUA; require LWP::UserAgent; @ISA = qw(LWP::UserAgent); -$VERSION = "6.06"; +$VERSION = "6.13"; require WWW::RobotRules; require HTTP::Request; diff --git a/Master/tlpkg/tlperl/lib/LWP/Simple.pm b/Master/tlpkg/tlperl/lib/LWP/Simple.pm index 29c538fdcdb..aa159c41d67 100644 --- a/Master/tlpkg/tlperl/lib/LWP/Simple.pm +++ b/Master/tlpkg/tlperl/lib/LWP/Simple.pm @@ -14,7 +14,7 @@ require Exporter; use HTTP::Status; push(@EXPORT, @HTTP::Status::EXPORT); -$VERSION = "6.00"; +$VERSION = "6.13"; sub import { diff --git a/Master/tlpkg/tlperl/lib/LWP/UserAgent.pm b/Master/tlpkg/tlperl/lib/LWP/UserAgent.pm index d558eabf0f9..0f0773e9ef4 100644 --- a/Master/tlpkg/tlperl/lib/LWP/UserAgent.pm +++ b/Master/tlpkg/tlperl/lib/LWP/UserAgent.pm @@ -5,7 +5,7 @@ use vars qw(@ISA $VERSION); require LWP::MemberMixin; @ISA = qw(LWP::MemberMixin); -$VERSION = "6.06"; +$VERSION = "6.13"; use HTTP::Request (); use HTTP::Response (); @@ -1196,8 +1196,8 @@ method for the more general interface that allow any header to be defaulted. =item $ua->cookie_jar( $cookie_jar_obj ) Get/set the cookie jar object to use. The only requirement is that -the cookie jar object must implement the extract_cookies($request) and -add_cookie_header($response) methods. These methods will then be +the cookie jar object must implement the extract_cookies($response) and +add_cookie_header($request) methods. These methods will then be invoked by the user agent as requests are sent and responses are received. Normally this will be a C<HTTP::Cookies> object or some subclass. |