[libcgi-emulate-psgi-perl] 10/20: Imported Upstream version 0.14

dom at earth.li dom at earth.li
Sun Oct 5 09:22:50 UTC 2014


This is an automated email from the git hooks/post-receive script.

dom pushed a commit to branch master
in repository libcgi-emulate-psgi-perl.

commit f1e65f4ef2d244137d85b891d5da851bd93f1799
Author: Dominic Hargreaves <dom at earth.li>
Date:   Sun Mar 18 19:07:34 2012 +0000

    Imported Upstream version 0.14
---
 Changes                        |  6 +++++
 META.yml                       |  9 +++----
 inc/Module/Install.pm          |  4 ++--
 inc/Module/Install/Base.pm     |  2 +-
 inc/Module/Install/Can.pm      |  2 +-
 inc/Module/Install/Fetch.pm    |  2 +-
 inc/Module/Install/Include.pm  |  2 +-
 inc/Module/Install/Makefile.pm | 11 ++++-----
 inc/Module/Install/Metadata.pm | 22 ++++++++++-------
 inc/Module/Install/Win32.pm    |  2 +-
 inc/Module/Install/WriteAll.pm |  2 +-
 lib/CGI/Emulate/PSGI.pm        |  3 ++-
 lib/CGI/Parse/PSGI.pm          |  6 ++++-
 t/02_parse.t                   | 54 +++++++++++++++++++++++++++++++++---------
 14 files changed, 88 insertions(+), 39 deletions(-)

diff --git a/Changes b/Changes
index 45799bb..796a4f4 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,9 @@
+0.14 Mon Oct 31 10:37:49 PDT 2011
+     - Fixed a bug where croak was not imported from Carp (ctfliblime)
+
+0.13 Sun Sep 18 12:10:56 PDT 2011
+     - Set the status header to 302 if there's Location header but no Status in the resonse (ASP)
+
 0.12 Thu Jun  9 23:58:10 PDT 2011
      - Fixed the PSGI header generation to prevent invalid PSGI response headers
        such as newlines in the value and "Status" key
diff --git a/META.yml b/META.yml
index 00d0224..87e14eb 100644
--- a/META.yml
+++ b/META.yml
@@ -3,11 +3,12 @@ abstract: 'PSGI adapter for CGI'
 author:
   - 'Tokuhiro Matsuno <tokuhirom at cpan.org>'
 build_requires:
-  ExtUtils::MakeMaker: 6.42
+  ExtUtils::MakeMaker: 6.62
 configure_requires:
-  ExtUtils::MakeMaker: 6.42
+  ExtUtils::MakeMaker: 6.62
 distribution_type: module
-generated_by: 'Module::Install version 1.01'
+dynamic_config: 1
+generated_by: 'Module::Install version 1.04'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -22,4 +23,4 @@ requires:
   perl: 5.8.0
 resources:
   license: http://dev.perl.org/licenses/
-version: 0.12
+version: 0.14
diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
index 74caf9c..c685ca4 100644
--- a/inc/Module/Install.pm
+++ b/inc/Module/Install.pm
@@ -31,7 +31,7 @@ BEGIN {
 	# This is not enforced yet, but will be some time in the next few
 	# releases once we can make sure it won't clash with custom
 	# Module::Install extensions.
-	$VERSION = '1.01';
+	$VERSION = '1.04';
 
 	# Storage for the pseudo-singleton
 	$MAIN    = undef;
@@ -451,7 +451,7 @@ sub _version ($) {
 }
 
 sub _cmp ($$) {
-	_version($_[0]) <=> _version($_[1]);
+	_version($_[1]) <=> _version($_[2]);
 }
 
 # Cloned from Params::Util::_CLASS
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm
index d3662c9..b520616 100644
--- a/inc/Module/Install/Base.pm
+++ b/inc/Module/Install/Base.pm
@@ -4,7 +4,7 @@ package Module::Install::Base;
 use strict 'vars';
 use vars qw{$VERSION};
 BEGIN {
-	$VERSION = '1.01';
+	$VERSION = '1.04';
 }
 
 # Suspend handler for "redefined" warnings
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
index 276409a..a162ad4 100644
--- a/inc/Module/Install/Can.pm
+++ b/inc/Module/Install/Can.pm
@@ -9,7 +9,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.01';
+	$VERSION = '1.04';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm
index 093cb7a..a412576 100644
--- a/inc/Module/Install/Fetch.pm
+++ b/inc/Module/Install/Fetch.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.01';
+	$VERSION = '1.04';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Include.pm b/inc/Module/Install/Include.pm
index 90cc979..dd001eb 100644
--- a/inc/Module/Install/Include.pm
+++ b/inc/Module/Install/Include.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.01';
+	$VERSION = '1.04';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
index 4c71003..035cef2 100644
--- a/inc/Module/Install/Makefile.pm
+++ b/inc/Module/Install/Makefile.pm
@@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/;
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.01';
+	$VERSION = '1.04';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
@@ -219,14 +219,14 @@ sub write {
 		# an underscore, even though its own version may contain one!
 		# Hence the funny regexp to get rid of it.  See RT #35800
 		# for details.
-		my $v = $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/;
+		my ($v) = $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/;
 		$self->build_requires(     'ExtUtils::MakeMaker' => $v );
 		$self->configure_requires( 'ExtUtils::MakeMaker' => $v );
 	} else {
 		# Allow legacy-compatibility with 5.005 by depending on the
 		# most recent EU:MM that supported 5.005.
-		$self->build_requires(     'ExtUtils::MakeMaker' => 6.42 );
-		$self->configure_requires( 'ExtUtils::MakeMaker' => 6.42 );
+		$self->build_requires(     'ExtUtils::MakeMaker' => 6.36 );
+		$self->configure_requires( 'ExtUtils::MakeMaker' => 6.36 );
 	}
 
 	# Generate the MakeMaker params
@@ -241,7 +241,6 @@ in a module, and provide its file path via 'version_from' (or
 'all_from' if you prefer) in Makefile.PL.
 EOT
 
-	$DB::single = 1;
 	if ( $self->tests ) {
 		my @tests = split ' ', $self->tests;
 		my %seen;
@@ -412,4 +411,4 @@ sub postamble {
 
 __END__
 
-#line 541
+#line 540
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
index 3b01e09..31c953e 100644
--- a/inc/Module/Install/Metadata.pm
+++ b/inc/Module/Install/Metadata.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.01';
+	$VERSION = '1.04';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
@@ -151,15 +151,21 @@ sub install_as_site   { $_[0]->installdirs('site')   }
 sub install_as_vendor { $_[0]->installdirs('vendor') }
 
 sub dynamic_config {
-	my $self = shift;
-	unless ( @_ ) {
-		warn "You MUST provide an explicit true/false value to dynamic_config\n";
-		return $self;
+	my $self  = shift;
+	my $value = @_ ? shift : 1;
+	if ( $self->{values}->{dynamic_config} ) {
+		# Once dynamic we never change to static, for safety
+		return 0;
 	}
-	$self->{values}->{dynamic_config} = $_[0] ? 1 : 0;
+	$self->{values}->{dynamic_config} = $value ? 1 : 0;
 	return 1;
 }
 
+# Convenience command
+sub static_config {
+	shift->dynamic_config(0);
+}
+
 sub perl_version {
 	my $self = shift;
 	return $self->{values}->{perl_version} unless @_;
@@ -170,7 +176,7 @@ sub perl_version {
 	# Normalize the version
 	$version = $self->_perl_version($version);
 
-	# We don't support the reall old versions
+	# We don't support the really old versions
 	unless ( $version >= 5.005 ) {
 		die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n";
 	}
@@ -582,7 +588,7 @@ sub bugtracker_from {
 sub requires_from {
 	my $self     = shift;
 	my $content  = Module::Install::_readperl($_[0]);
-	my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg;
+	my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+(v?[\d\.]+)/mg;
 	while ( @requires ) {
 		my $module  = shift @requires;
 		my $version = shift @requires;
diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm
index 3139a63..99d9631 100644
--- a/inc/Module/Install/Win32.pm
+++ b/inc/Module/Install/Win32.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.01';
+	$VERSION = '1.04';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
index 1f724a7..86bb25e 100644
--- a/inc/Module/Install/WriteAll.pm
+++ b/inc/Module/Install/WriteAll.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.01';
+	$VERSION = '1.04';
 	@ISA     = qw{Module::Install::Base};
 	$ISCORE  = 1;
 }
diff --git a/lib/CGI/Emulate/PSGI.pm b/lib/CGI/Emulate/PSGI.pm
index 42a1109..5504966 100644
--- a/lib/CGI/Emulate/PSGI.pm
+++ b/lib/CGI/Emulate/PSGI.pm
@@ -5,9 +5,10 @@ use CGI::Parse::PSGI;
 use POSIX 'SEEK_SET';
 use IO::File ();
 use SelectSaver;
+use Carp qw(croak);
 use 5.00800;
 
-our $VERSION = '0.12';
+our $VERSION = '0.14';
 
 sub handler {
     my ($class, $code, ) = @_;
diff --git a/lib/CGI/Parse/PSGI.pm b/lib/CGI/Parse/PSGI.pm
index 69bd489..5e05354 100644
--- a/lib/CGI/Parse/PSGI.pm
+++ b/lib/CGI/Parse/PSGI.pm
@@ -34,7 +34,11 @@ sub parse_cgi_output {
     }
 
     my $response = HTTP::Response->parse($headers);
-    $response->date( time() ) unless $response->date;
+
+    # RFC 3875 6.2.3
+    if ($response->header('Location') && !$response->header('Status')) {
+        $response->header('Status', 302);
+    }
 
     my $status = $response->header('Status') || 200;
     $status =~ s/\s+.*$//; # remove ' OK' in '200 OK'
diff --git a/t/02_parse.t b/t/02_parse.t
index b4d8c4c..7d4c4a4 100644
--- a/t/02_parse.t
+++ b/t/02_parse.t
@@ -2,7 +2,8 @@ use strict;
 use Test::More;
 use CGI::Parse::PSGI qw(parse_cgi_output);
 
-my $output = <<CGI;
+{
+    my $output = <<CGI;
 Status: 302
 Content-Type: text/html
 X-Foo: bar
@@ -11,21 +12,52 @@ Location: http://localhost/
 This is the body!
 CGI
 
-my $r = parse_cgi_output(\$output);
-is $r->[0], 302;
+    my($r, $h) = _parse($output);
+    is $r->[0], 302;
 
-my $h = HTTP::Headers->new;
-while (my($k, $v) = splice @{$r->[1]}, 0, 2) {
-    $h->header($k, $v);
+    is $h->content_length, 18;
+    is $h->content_type, 'text/html';
+    is $h->header('Location'), 'http://localhost/';
+
+    is_deeply $r->[2], [ "This is the body!\n" ];
 }
 
-is $h->content_length, 18;
-is $h->content_type, 'text/html';
-is $h->header('Location'), 'http://localhost/';
+{
+    # rfc3875 6.2.3
+    my $output = <<CGI;
+Location: http://google.com/
 
-is_deeply $r->[2], [ "This is the body!\n" ];
+CGI
+    my($r, $h) = _parse($output);
+    is $r->[0], 302;
+    is $h->header('Location'), 'http://google.com/';
+}
 
-done_testing;
+{
+    # rfc3875 6.2.4
+    my $output = <<CGI;
+Status: 301
+Location: http://google.com/
+Content-Type: text/html
 
+Redirected
+CGI
+    my($r, $h) = _parse($output);
+    is $r->[0], 301;
+    is $h->header('Location'), 'http://google.com/';
+    is $h->content_type, 'text/html';
+    is_deeply $r->[2], [ "Redirected\n" ];
+}
 
+done_testing;
 
+sub _parse {
+    my $output = shift;
+    my $r = parse_cgi_output(\$output);
+
+    my $h = HTTP::Headers->new;
+    while (my($k, $v) = splice @{$r->[1]}, 0, 2) {
+        $h->header($k, $v);
+    }
+    return $r, $h;
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcgi-emulate-psgi-perl.git



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