r32594 - in /branches/upstream/liblwp-protocol-socks-perl: ./ current/ current/lib/ current/lib/LWP/ current/lib/LWP/Protocol/ current/lib/URI/ current/t/

npf-guest at users.alioth.debian.org npf-guest at users.alioth.debian.org
Fri Apr 3 22:00:07 UTC 2009


Author: npf-guest
Date: Fri Apr  3 21:59:52 2009
New Revision: 32594

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

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

Added: branches/upstream/liblwp-protocol-socks-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblwp-protocol-socks-perl/current/Changes?rev=32594&op=file
==============================================================================
--- branches/upstream/liblwp-protocol-socks-perl/current/Changes (added)
+++ branches/upstream/liblwp-protocol-socks-perl/current/Changes Fri Apr  3 21:59:52 2009
@@ -1,0 +1,6 @@
+Revision history for Perl extension LWP::Protocol::socks.
+
+0.01  Mon Jul  7 21:30:04 2008
+	- original version; created by h2xs 1.23 with options
+		-b 5.6.1 -AXn LWP::Protocol::socks
+

Added: branches/upstream/liblwp-protocol-socks-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblwp-protocol-socks-perl/current/MANIFEST?rev=32594&op=file
==============================================================================
--- branches/upstream/liblwp-protocol-socks-perl/current/MANIFEST (added)
+++ branches/upstream/liblwp-protocol-socks-perl/current/MANIFEST Fri Apr  3 21:59:52 2009
@@ -1,0 +1,8 @@
+Changes
+Makefile.PL
+MANIFEST
+README
+t/LWP-Protocol-socks.t
+lib/LWP/Protocol/socks.pm
+lib/URI/socks.pm
+META.yml

Added: branches/upstream/liblwp-protocol-socks-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblwp-protocol-socks-perl/current/META.yml?rev=32594&op=file
==============================================================================
--- branches/upstream/liblwp-protocol-socks-perl/current/META.yml (added)
+++ branches/upstream/liblwp-protocol-socks-perl/current/META.yml Fri Apr  3 21:59:52 2009
@@ -1,0 +1,12 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
+name:         LWP-Protocol-socks
+version:      1.1
+version_from: lib/LWP/Protocol/socks.pm
+installdirs:  site
+requires:
+    IO::Socket::Socks:             0.1
+    IO::Socket::SSL:               0.96
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.30

Added: branches/upstream/liblwp-protocol-socks-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblwp-protocol-socks-perl/current/Makefile.PL?rev=32594&op=file
==============================================================================
--- branches/upstream/liblwp-protocol-socks-perl/current/Makefile.PL (added)
+++ branches/upstream/liblwp-protocol-socks-perl/current/Makefile.PL Fri Apr  3 21:59:52 2009
@@ -1,0 +1,15 @@
+use 5.006001;
+use ExtUtils::MakeMaker;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+    NAME              => 'LWP::Protocol::socks',
+    VERSION_FROM      => 'lib/LWP/Protocol/socks.pm', # finds $VERSION
+    'PREREQ_PM' => {
+        'IO::Socket::Socks' => 0.1,
+        'IO::Socket::SSL'   => 0.96,
+    },
+    ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
+      (ABSTRACT_FROM  => 'lib/LWP/Protocol/socks.pm', # retrieve abstract from module
+       AUTHOR         => 'Sheridan Rawlins <scr at corp.yahoo.com>') : ()),
+);

Added: branches/upstream/liblwp-protocol-socks-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblwp-protocol-socks-perl/current/README?rev=32594&op=file
==============================================================================
--- branches/upstream/liblwp-protocol-socks-perl/current/README (added)
+++ branches/upstream/liblwp-protocol-socks-perl/current/README Fri Apr  3 21:59:52 2009
@@ -1,0 +1,40 @@
+LWP-Protocol-socks version 0.01
+===============================
+
+The README is used to introduce the module and provide instructions on
+how to install the module, any machine dependencies it may have (for
+example C compilers and installed libraries) and any other information
+that should be provided before the module is installed.
+
+A README file is required for CPAN modules since CPAN extracts the
+README file from a module distribution so that people browsing the
+archive can use it get an idea of the modules uses. It is usually a
+good idea to provide version information here so that people can
+decide whether fixes for the module are worth downloading.
+
+INSTALLATION
+
+To install this module type the following:
+
+   perl Makefile.PL
+   make
+   make test
+   make install
+
+DEPENDENCIES
+
+This module requires these other modules and libraries:
+
+  blah blah blah
+
+COPYRIGHT AND LICENCE
+
+Put the correct copyright and licence information here.
+
+Copyright (C) 2008 by Sheridan Rawlins
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.8.5 or,
+at your option, any later version of Perl 5 you may have available.
+
+

Added: branches/upstream/liblwp-protocol-socks-perl/current/lib/LWP/Protocol/socks.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblwp-protocol-socks-perl/current/lib/LWP/Protocol/socks.pm?rev=32594&op=file
==============================================================================
--- branches/upstream/liblwp-protocol-socks-perl/current/lib/LWP/Protocol/socks.pm (added)
+++ branches/upstream/liblwp-protocol-socks-perl/current/lib/LWP/Protocol/socks.pm Fri Apr  3 21:59:52 2009
@@ -1,0 +1,150 @@
+##############################
+package LWP::Protocol::http::socks;
+require LWP::Protocol::http;
+our @ISA = qw(LWP::Protocol::http);
+our $VERSION = "1.1";
+LWP::Protocol::implementor('http::socks' => 'LWP::Protocol::http::socks');
+
+sub new {
+    my $self = shift->SUPER::new(@_);
+    $self->{scheme} =~ s/::socks$//;
+    $self;
+}
+
+sub _extra_sock_opts {
+    my $self = shift;
+    my($host, $port) = @_;
+    my @extra_sock_opts = $self->SUPER::_extra_sock_opts(@_);
+    #(@extra_sock_opts, SocksDebug =>1, @{$self->{proxy_sock_opts}});
+    (@extra_sock_opts, @{$self->{proxy_sock_opts}});
+}
+
+##############################
+package LWP::Protocol::http::socks::Socket;
+require LWP::Protocol::http;
+require IO::Socket::Socks;
+require Net::HTTP;
+our @ISA = qw(LWP::Protocol::http::SocketMethods IO::Socket::Socks Net::HTTP);
+
+sub configure {
+    my $self = shift;
+    my $args = shift;
+
+    my $connectAddr = $args->{ConnectAddr} = delete $args->{PeerAddr};
+    my $connectPort = $args->{ConnectPort} = delete $args->{PeerPort};
+
+    $self->SUPER::configure($args);
+    $self->http_configure($args);
+}
+
+##############################
+package LWP::Protocol::https::socks;
+require LWP::Protocol::https;
+our @ISA = qw(LWP::Protocol::https);
+LWP::Protocol::implementor('https::socks' => 'LWP::Protocol::https::socks');
+
+sub new {
+    my $self = shift->SUPER::new(@_);
+    $self->{scheme} =~ s/::socks$//;
+    $self;
+}
+
+sub _extra_sock_opts {
+    my $self = shift;
+    my($host, $port) = @_;
+    my @extra_sock_opts = $self->SUPER::_extra_sock_opts(@_);
+    (@extra_sock_opts, @{$self->{proxy_sock_opts}});
+    #(@extra_sock_opts, @{$self->{proxy_sock_opts}});
+}
+
+##############################
+package LWP::Protocol::https::socks::Socket;
+require LWP::Protocol::https;
+require IO::Socket::Socks;
+use IO::Socket::SSL;
+require Net::HTTPS;
+our @ISA = qw(LWP::Protocol::https::Socket);
+
+sub new {
+    my $class = shift;
+    my %args = @_;
+    my $connectAddr = $args{ConnectAddr} = delete $args{PeerAddr};
+    my $connectPort = $args{ConnectPort} = delete $args{PeerPort};
+    my $socks = new IO::Socket::Socks(%args);
+    $args{PeerAddr} = $connectAddr;
+    $args{PeerPort} = $connectPort;
+    delete $args{ProxyAddr};
+    delete $args{ProxyPort};
+    delete $args{ConnectAddr};
+    delete $args{ConnectPort};
+    my $ssl = new_from_fd LWP::Protocol::https::socks::Socket($socks, %args);
+    $ssl->http_configure(\%args);
+    $ssl;
+}
+
+# hack out the connect so it doesn't reconnect
+sub http_connect {
+    1;
+}
+
+##############################
+package LWP::Protocol::socks;
+require LWP::Protocol;
+our @ISA = qw(LWP::Protocol);
+
+sub request {
+    my($self, $request, $proxy, $arg, $size, $timeout) = @_;
+    my $url = $request->uri;
+    my $scheme = $url->scheme;
+
+    my $protocol = LWP::Protocol::create("$scheme\::socks", $self->{ua});
+    $protocol->{proxy_sock_opts} = [ProxyAddr => $proxy->host,
+				    ProxyPort => $proxy->port,
+				    ];
+    $protocol->request($request, undef, $arg, $size, $timeout);
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+LWP::Protocol::socks - adds support for the socks protocol and proxy facility
+
+=head1 SYNOPSIS
+
+use LWP::Protocol::socks;
+
+=head1 DESCRIPTION
+
+Use this package when you wish to use a socks proxy for your
+connections.
+
+It provides some essential hooks into the LWP system to implement a
+socks "scheme" similar to http for describing your socks connection,
+and can be used to proxy either http or https connections.
+
+The use case is to use LWP::UserAgent's proxy method to register your
+socks proxy like so:
+
+ $ua->proxy([qw(http https)] => 'socks://socks.yahoo.com:1080');
+
+Then just use your $ua object as usual!
+
+=head1 EXAMPLES
+
+ #!/usr/local/bin/perl
+ use strict;
+ use LWP::UserAgent;
+
+ my $ua = new LWP::UserAgent(agent => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5');
+ $ua->proxy([qw(http https)] => 'socks://socks.yahoo.com:1080');
+ my $response = $ua->get("http://www.freebsd.org");
+ print $response->code,' ', $response->message,"\n";
+ my $response = $ua->get("https://www.microsoft.com");
+ print $response->code,' ', $response->message,"\n";
+
+=head1 AUTHOR
+
+Sheridan C Rawlins E<lt>F<scr at yahoo-inc.com>E<gt>

Added: branches/upstream/liblwp-protocol-socks-perl/current/lib/URI/socks.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblwp-protocol-socks-perl/current/lib/URI/socks.pm?rev=32594&op=file
==============================================================================
--- branches/upstream/liblwp-protocol-socks-perl/current/lib/URI/socks.pm (added)
+++ branches/upstream/liblwp-protocol-socks-perl/current/lib/URI/socks.pm Fri Apr  3 21:59:52 2009
@@ -1,0 +1,7 @@
+##############################
+package URI::socks;
+require URI::http;
+#URI::implementor(socks => 'URI::http');
+our @ISA = qw(URI::http);
+
+1;

Added: branches/upstream/liblwp-protocol-socks-perl/current/t/LWP-Protocol-socks.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblwp-protocol-socks-perl/current/t/LWP-Protocol-socks.t?rev=32594&op=file
==============================================================================
--- branches/upstream/liblwp-protocol-socks-perl/current/t/LWP-Protocol-socks.t (added)
+++ branches/upstream/liblwp-protocol-socks-perl/current/t/LWP-Protocol-socks.t Fri Apr  3 21:59:52 2009
@@ -1,0 +1,17 @@
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl LWP-Protocol-socks.t'
+
+#########################
+
+# change 'tests => 1' to 'tests => last_test_to_print';
+
+use Test;
+BEGIN { plan tests => 1 };
+use LWP::Protocol::socks;
+ok(1); # If we made it this far, we're ok.
+
+#########################
+
+# Insert your test code below, the Test::More module is use()ed here so read
+# its man page ( perldoc Test::More ) for help writing this test script.
+




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