r72045 - in /branches/upstream/liblwp-protocol-https-perl: ./ current/ current/lib/ current/lib/LWP/ current/lib/LWP/Protocol/ current/t/

periapt-guest at users.alioth.debian.org periapt-guest at users.alioth.debian.org
Tue Mar 29 23:17:43 UTC 2011


Author: periapt-guest
Date: Tue Mar 29 23:17:22 2011
New Revision: 72045

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=72045
Log:
[svn-inject] Installing original source of liblwp-protocol-https-perl (6.02)

Added:
    branches/upstream/liblwp-protocol-https-perl/
    branches/upstream/liblwp-protocol-https-perl/current/
    branches/upstream/liblwp-protocol-https-perl/current/Changes
    branches/upstream/liblwp-protocol-https-perl/current/MANIFEST
    branches/upstream/liblwp-protocol-https-perl/current/META.yml
    branches/upstream/liblwp-protocol-https-perl/current/Makefile.PL
    branches/upstream/liblwp-protocol-https-perl/current/README
    branches/upstream/liblwp-protocol-https-perl/current/lib/
    branches/upstream/liblwp-protocol-https-perl/current/lib/LWP/
    branches/upstream/liblwp-protocol-https-perl/current/lib/LWP/Protocol/
    branches/upstream/liblwp-protocol-https-perl/current/lib/LWP/Protocol/https.pm
    branches/upstream/liblwp-protocol-https-perl/current/t/
    branches/upstream/liblwp-protocol-https-perl/current/t/apache.t

Added: branches/upstream/liblwp-protocol-https-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblwp-protocol-https-perl/current/Changes?rev=72045&op=file
==============================================================================
--- branches/upstream/liblwp-protocol-https-perl/current/Changes (added)
+++ branches/upstream/liblwp-protocol-https-perl/current/Changes Tue Mar 29 23:17:22 2011
@@ -1,0 +1,11 @@
+_______________________________________________________________________________
+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.

Added: branches/upstream/liblwp-protocol-https-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblwp-protocol-https-perl/current/MANIFEST?rev=72045&op=file
==============================================================================
--- branches/upstream/liblwp-protocol-https-perl/current/MANIFEST (added)
+++ branches/upstream/liblwp-protocol-https-perl/current/MANIFEST Tue Mar 29 23:17:22 2011
@@ -1,0 +1,7 @@
+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 meta-data (added by MakeMaker)

Added: branches/upstream/liblwp-protocol-https-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblwp-protocol-https-perl/current/META.yml?rev=72045&op=file
==============================================================================
--- branches/upstream/liblwp-protocol-https-perl/current/META.yml (added)
+++ branches/upstream/liblwp-protocol-https-perl/current/META.yml Tue Mar 29 23:17:22 2011
@@ -1,0 +1,29 @@
+--- #YAML:1.0
+name:               LWP-Protocol-https
+version:            6.02
+abstract:           Provide https support for LWP::UserAgent
+author:
+    - Gisle Aas <gisle at activestate.com>
+license:            perl
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
+build_requires:
+    ExtUtils::MakeMaker:  0
+requires:
+    IO::Socket::SSL:  1.38
+    LWP::UserAgent:   6.02
+    Mozilla::CA:      20110101
+    Net::HTTPS:       6
+    perl:             5.008008
+resources:
+    MailingList:  mailto:libwww at perl.org
+    repository:   http://github.com/gisle/libwww-perl/tree/LWP-Protocol-https/master
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.57_05
+meta-spec:
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4

Added: branches/upstream/liblwp-protocol-https-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblwp-protocol-https-perl/current/Makefile.PL?rev=72045&op=file
==============================================================================
--- branches/upstream/liblwp-protocol-https-perl/current/Makefile.PL (added)
+++ branches/upstream/liblwp-protocol-https-perl/current/Makefile.PL Tue Mar 29 23:17:22 2011
@@ -1,0 +1,49 @@
+#!perl -w
+
+require 5.008008;
+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 <gisle at activestate.com>',
+    LICENSE => "perl",
+    MIN_PERL_VERSION => 5.008008,
+    PREREQ_PM => {
+	'LWP::UserAgent' => '6.02',
+	'Net::HTTPS' => 6,
+	'IO::Socket::SSL' => "1.38",
+	'Mozilla::CA' => "20110101",
+    },
+    META_MERGE => {
+	resources => {
+            repository => 'http://github.com/gisle/libwww-perl/tree/LWP-Protocol-https/master',
+	    MailingList => 'mailto:libwww at 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);
+    };
+}

Added: branches/upstream/liblwp-protocol-https-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblwp-protocol-https-perl/current/README?rev=72045&op=file
==============================================================================
--- branches/upstream/liblwp-protocol-https-perl/current/README (added)
+++ branches/upstream/liblwp-protocol-https-perl/current/README Tue Mar 29 23:17:22 2011
@@ -1,0 +1,37 @@
+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.
+

Added: branches/upstream/liblwp-protocol-https-perl/current/lib/LWP/Protocol/https.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblwp-protocol-https-perl/current/lib/LWP/Protocol/https.pm?rev=72045&op=file
==============================================================================
--- branches/upstream/liblwp-protocol-https-perl/current/lib/LWP/Protocol/https.pm (added)
+++ branches/upstream/liblwp-protocol-https-perl/current/lib/LWP/Protocol/https.pm Tue Mar 29 23:17:22 2011
@@ -1,0 +1,132 @@
+package LWP::Protocol::https;
+
+use strict;
+our $VERSION = "6.02";
+
+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';
+    }
+    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 knowning 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 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 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.

Added: branches/upstream/liblwp-protocol-https-perl/current/t/apache.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblwp-protocol-https-perl/current/t/apache.t?rev=72045&op=file
==============================================================================
--- branches/upstream/liblwp-protocol-https-perl/current/t/apache.t (added)
+++ branches/upstream/liblwp-protocol-https-perl/current/t/apache.t Tue Mar 29 23:17:22 2011
@@ -1,0 +1,15 @@
+#!perl -w
+
+use strict;
+use Test;
+
+use LWP::UserAgent;
+
+my $ua = LWP::UserAgent->new();
+my $res = $ua->simple_request(HTTP::Request->new(GET => "https://www.apache.org"));
+
+plan tests => 2;
+ok($res->is_success);
+ok($res->content =~ /Apache Software Foundation/);
+
+$res->dump(prefix => "# ");




More information about the Pkg-perl-cvs-commits mailing list