LWP-Protocol-https-6.04/000755 000765 000024 00000000000 12137562301 015312 5ustar00gislestaff000000 000000 LWP-Protocol-https-6.04/Changes000644 000765 000024 00000002000 12137561706 016605 0ustar00gislestaff000000 000000 _______________________________________________________________________________ 2013-04-29 LWP-Protocol-https 6.04 Fix IO::Socket::SSL warnings when not verifying hostname. Doc spelling fix. _______________________________________________________________________________ 2012-02-18 LWP-Protocol-https 6.03 Skip test if offline [RT#74163] Typo fixes Restore perl-5.8.1 compatibility. _______________________________________________________________________________ 2011-03-27 LWP-Protocol-https 6.02 Initial release of LWP-Protocol-https as a separate distribution. There are no code changes besides setting the version number since libwww-perl-6.01. The LWP::Protocol::https module used to be bundled with the libwww-perl distribution, 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. LWP-Protocol-https-6.04/lib/000755 000765 000024 00000000000 12137562301 016060 5ustar00gislestaff000000 000000 LWP-Protocol-https-6.04/Makefile.PL000644 000765 000024 00000002342 12122151552 017261 0ustar00gislestaff000000 000000 #!perl -w require 5.008001; use strict; use ExtUtils::MakeMaker; use Getopt::Long qw(GetOptions); WriteMakefile( NAME => 'LWP::Protocol::https', VERSION_FROM => 'lib/LWP/Protocol/https.pm', ABSTRACT_FROM => 'lib/LWP/Protocol/https.pm', AUTHOR => 'Gisle Aas ', LICENSE => "perl", MIN_PERL_VERSION => 5.008001, PREREQ_PM => { 'LWP::UserAgent' => '6.04', 'Net::HTTPS' => 6, 'IO::Socket::SSL' => "1.54", 'Mozilla::CA' => "20110101", }, META_MERGE => { resources => { repository => 'http://github.com/libwww-perl/lwp-protocol-https', MailingList => 'mailto:libwww@perl.org', } }, ); BEGIN { # compatibility with older versions of MakeMaker my $developer = -f ".gitignore"; my %mm_req = ( LICENCE => 6.31, META_MERGE => 6.45, META_ADD => 6.45, MIN_PERL_VERSION => 6.48, ); undef(*WriteMakefile); *WriteMakefile = sub { my %arg = @_; for (keys %mm_req) { unless (eval { ExtUtils::MakeMaker->VERSION($mm_req{$_}) }) { warn "$_ $@" if $developer; delete $arg{$_}; } } ExtUtils::MakeMaker::WriteMakefile(%arg); }; } LWP-Protocol-https-6.04/MANIFEST000644 000765 000024 00000000524 12137562301 016444 0ustar00gislestaff000000 000000 Changes History of this package MANIFEST This file Makefile.PL Makefile generator README lib/LWP/Protocol/https.pm Access with HTTP/1.1 protocol over SSL t/apache.t META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) LWP-Protocol-https-6.04/META.json000644 000765 000024 00000002307 12137562301 016735 0ustar00gislestaff000000 000000 { "abstract" : "Provide https support for LWP::UserAgent", "author" : [ "Gisle Aas " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 6.6501, CPAN::Meta::Converter version 2.120921", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "LWP-Protocol-https", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { "IO::Socket::SSL" : "1.54", "LWP::UserAgent" : "6.04", "Mozilla::CA" : "20110101", "Net::HTTPS" : "6", "perl" : "5.008001" } } }, "release_status" : "stable", "resources" : { "repository" : { "url" : "http://github.com/libwww-perl/lwp-protocol-https" }, "x_MailingList" : "mailto:libwww@perl.org" }, "version" : "6.04" } LWP-Protocol-https-6.04/META.yml000644 000765 000024 00000001307 12137562301 016564 0ustar00gislestaff000000 000000 --- abstract: 'Provide https support for LWP::UserAgent' author: - 'Gisle Aas ' build_requires: ExtUtils::MakeMaker: 0 configure_requires: ExtUtils::MakeMaker: 0 dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 6.6501, CPAN::Meta::Converter version 2.120921' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: LWP-Protocol-https no_index: directory: - t - inc requires: IO::Socket::SSL: 1.54 LWP::UserAgent: 6.04 Mozilla::CA: 20110101 Net::HTTPS: 6 perl: 5.008001 resources: repository: http://github.com/libwww-perl/lwp-protocol-https x_MailingList: mailto:libwww@perl.org version: 6.04 LWP-Protocol-https-6.04/README000644 000765 000024 00000002672 12122151552 016175 0ustar00gislestaff000000 000000 NAME LWP::Protocol::https - Provide https support for LWP::UserAgent SYNOPSIS use LWP::UserAgent; $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 1 }); $res = $ua->get("https://www.example.com"); DESCRIPTION The LWP::Protocol::https module provide 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 `ssl_opts', and neither `SSL_ca_file' nor `SSL_ca_path' is set, then `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 `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. SEE ALSO IO::Socket::SSL, Crypt::SSLeay, Mozilla::CA 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. LWP-Protocol-https-6.04/t/000755 000765 000024 00000000000 12137562301 015555 5ustar00gislestaff000000 000000 LWP-Protocol-https-6.04/t/apache.t000644 000765 000024 00000001171 12137561361 017170 0ustar00gislestaff000000 000000 #!perl -w use strict; use Test::More; use LWP::UserAgent; my $ua = LWP::UserAgent->new(); plan skip_all => "Not online" unless $ua->is_online; plan tests => 4; my $res = $ua->simple_request(HTTP::Request->new(GET => "https://www.apache.org")); ok($res->is_success); like($res->content, qr/Apache Software Foundation/); # test for RT #81948 my $warn = ''; $SIG{__WARN__} = sub { $warn = shift }; $ua = LWP::UserAgent->new( ssl_opts => {verify_hostname => 0} ); $res = $ua->simple_request(HTTP::Request->new(GET => "https://www.apache.org")); ok($res->is_success); is($warn, '', "no warning seen"); $res->dump(prefix => "# "); LWP-Protocol-https-6.04/lib/LWP/000755 000765 000024 00000000000 12137562301 016522 5ustar00gislestaff000000 000000 LWP-Protocol-https-6.04/lib/LWP/Protocol/000755 000765 000024 00000000000 12137562301 020323 5ustar00gislestaff000000 000000 LWP-Protocol-https-6.04/lib/LWP/Protocol/https.pm000644 000765 000024 00000007704 12137561442 022040 0ustar00gislestaff000000 000000 package LWP::Protocol::https; use strict; our $VERSION = "6.04"; require LWP::Protocol::http; our @ISA = qw(LWP::Protocol::http); 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 envirionment variable or by installing the Mozilla::CA module. To disable verification of SSL peers set the PERL_LWP_SSL_VERIFY_HOSTNAME envirionment 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); } 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; die "Bad SSL certificate subject: '$subject' !~ /$check/" unless $subject =~ /$check/; $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); } #----------------------------------------------------------- package LWP::Protocol::https::Socket; require Net::HTTPS; 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, and neither C nor C is set, then C 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 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, L, L =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.