r53407 - in /trunk/libhttp-server-simple-perl: Changes META.yml Makefile.PL SIGNATURE debian/changelog debian/control lib/HTTP/Server/Simple.pm lib/HTTP/Server/Simple/CGI.pm lib/HTTP/Server/Simple/CGI/Environment.pm t/04cgi.t

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Sun Feb 28 17:30:53 UTC 2010


Author: jawnsy-guest
Date: Sun Feb 28 17:30:44 2010
New Revision: 53407

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=53407
Log:
TODO: look at patches
* New upstream release

Modified:
    trunk/libhttp-server-simple-perl/Changes
    trunk/libhttp-server-simple-perl/META.yml
    trunk/libhttp-server-simple-perl/Makefile.PL
    trunk/libhttp-server-simple-perl/SIGNATURE
    trunk/libhttp-server-simple-perl/debian/changelog
    trunk/libhttp-server-simple-perl/debian/control
    trunk/libhttp-server-simple-perl/lib/HTTP/Server/Simple.pm
    trunk/libhttp-server-simple-perl/lib/HTTP/Server/Simple/CGI.pm
    trunk/libhttp-server-simple-perl/lib/HTTP/Server/Simple/CGI/Environment.pm
    trunk/libhttp-server-simple-perl/t/04cgi.t

Modified: trunk/libhttp-server-simple-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-server-simple-perl/Changes?rev=53407&op=diff
==============================================================================
--- trunk/libhttp-server-simple-perl/Changes (original)
+++ trunk/libhttp-server-simple-perl/Changes Sun Feb 28 17:30:44 2010
@@ -1,3 +1,17 @@
+0.42 Thu Feb 18 10:13:11 PST 2010
+
+* Inline uri_unescape to drop URI::Escape which is the only non-core
+  dependency of this distribution. -- miyagawa
+
+* Do not special case COOKIE and sets Cookie header to HTTP_COOKIE. -- miyagawa
+
+  O'Reilly's WebSite server misuses COOKIE environment instead of
+  HTTP_COOKIE. We don't need to replicate that bug since
+  HTTP::Server::Simple is a server, not a CGI library like CGI.pm.
+    
+0.41_01 Tue Feb  2 12:08:15 PST 2010
+
+* Pluggable CGI class support based on a patch from NANIS
 
 0.41 Tue Sep 29 23:05:04 JST 2009
 

Modified: trunk/libhttp-server-simple-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-server-simple-perl/META.yml?rev=53407&op=diff
==============================================================================
--- trunk/libhttp-server-simple-perl/META.yml (original)
+++ trunk/libhttp-server-simple-perl/META.yml Sun Feb 28 17:30:44 2010
@@ -19,7 +19,6 @@
   CGI: 0
   Socket: 0
   Test::More: 0
-  URI::Escape: 0
 resources:
   license: http://dev.perl.org/licenses/
-version: 0.41
+version: 0.42

Modified: trunk/libhttp-server-simple-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-server-simple-perl/Makefile.PL?rev=53407&op=diff
==============================================================================
--- trunk/libhttp-server-simple-perl/Makefile.PL (original)
+++ trunk/libhttp-server-simple-perl/Makefile.PL Sun Feb 28 17:30:44 2010
@@ -7,7 +7,6 @@
     Socket      => 0,
     Test::More  => 0,
     CGI         => 0,
-    URI::Escape => 0
 );
 
 WriteAll( sign => 1);

Modified: trunk/libhttp-server-simple-perl/SIGNATURE
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-server-simple-perl/SIGNATURE?rev=53407&op=diff
==============================================================================
--- trunk/libhttp-server-simple-perl/SIGNATURE (original)
+++ trunk/libhttp-server-simple-perl/SIGNATURE Sun Feb 28 17:30:44 2010
@@ -1,5 +1,5 @@
 This file contains message digests of all files listed in MANIFEST,
-signed via the Module::Signature module, version 0.55.
+signed via the Module::Signature module, version 0.61.
 
 To verify the content in this distribution, first make sure you have
 Module::Signature installed, then type:
@@ -14,11 +14,11 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-SHA1 cb925c8d7dfbfc3f935e4506cafcf4730bb6749f Changes
+SHA1 0a29741c06291a7fc5769a3e436ba4ffb86064a6 Changes
 SHA1 949066363c947341783f1fe4c949f02940e8fa73 MANIFEST
 SHA1 e476d8bd724d46eb9e255cc8afc98b92269e2255 MANIFEST.SKIP
-SHA1 e448aef01af5a87f939c17187f6b3fed31df842c META.yml
-SHA1 9e87872a0de469e0e368e80a9492800e5c8f543d Makefile.PL
+SHA1 974dc93c9c6fdb4dcccd5defff966e5e393972c0 META.yml
+SHA1 a5b451d8a16d1d7978174b0fd9270764847de2b8 Makefile.PL
 SHA1 ed0c107672daac3bc9e266876666e1059dbe44b7 README
 SHA1 4ea1e9072ca87399184a46233df52a21e285604d ex/sample_server
 SHA1 fd5f3c4f0418efee3b9b16cf8c3902e8374909df inc/Module/Install.pm
@@ -29,19 +29,19 @@
 SHA1 12bf1867955480d47d5171a9e9c6a96fabe0b58f inc/Module/Install/Metadata.pm
 SHA1 f7ee667e878bd2faf22ee9358a7b5a2cc8e91ba4 inc/Module/Install/Win32.pm
 SHA1 8ed29d6cf217e0977469575d788599cbfb53a5ca inc/Module/Install/WriteAll.pm
-SHA1 68766ff780204e8ae4a1b29f93ac85ed5608e3a4 lib/HTTP/Server/Simple.pm
-SHA1 3ddd188b0ee926a7e114e711b88c0af69b9a9079 lib/HTTP/Server/Simple/CGI.pm
-SHA1 36169be31d05df472b069e2f6b258c056fd9acc0 lib/HTTP/Server/Simple/CGI/Environment.pm
+SHA1 279f27b5cbaade45506fee36bb579d603d391abb lib/HTTP/Server/Simple.pm
+SHA1 c84b60c7ebdcc12d1814909f957bf3b385fa60c2 lib/HTTP/Server/Simple/CGI.pm
+SHA1 1fcf911a2e8aa609bbdf519b389015b3d616b933 lib/HTTP/Server/Simple/CGI/Environment.pm
 SHA1 41afe2c04bb573b40e283e2b210ed70a47a3f8ba t/00signature.t
 SHA1 db064af54cab345a71daec576e32e64b8fb1033d t/00smoke.t
 SHA1 3f3ccd583b7d01627b7c043229f1b7fb52a6a73c t/01live.t
 SHA1 aca95653cfce68912e08c57b3a4566207e2f99b3 t/02pod.t
 SHA1 a7024d0d8e7b80d26f75a3551a1406a797b382f8 t/03podcoverage.t
-SHA1 3fbe600fc1aab20d9351bbb75d2dcb3f2ef2bb76 t/04cgi.t
+SHA1 8edf693744545698371dc75d55d4ec27f59848f0 t/04cgi.t
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.9 (GNU/Linux)
 
-iEYEARECAAYFAkrCFCcACgkQEi9d9xCOQEYplACdHa+8QVpTIVoB/aD58dNNb0Ij
-TRAAoMP70VQcluM33E7xo1qjxwZc723Q
-=WAjI
+iEYEARECAAYFAkt9g44ACgkQEi9d9xCOQEZBNgCeMHCJTYSMTxx3ueUMku/CXGG4
+/nYAoKAkLYTinvg6SA7Xif5zTozrliMm
+=MbtY
 -----END PGP SIGNATURE-----

Modified: trunk/libhttp-server-simple-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-server-simple-perl/debian/changelog?rev=53407&op=diff
==============================================================================
--- trunk/libhttp-server-simple-perl/debian/changelog (original)
+++ trunk/libhttp-server-simple-perl/debian/changelog Sun Feb 28 17:30:44 2010
@@ -1,3 +1,11 @@
+libhttp-server-simple-perl (0.42-1) UNRELEASED; urgency=low
+
+  TODO: look at patches
+
+  * New upstream release
+
+ -- Jonathan Yu <jawnsy at cpan.org>  Sun, 28 Feb 2010 12:38:08 -0500
+
 libhttp-server-simple-perl (0.41-1) unstable; urgency=low
 
   [ Jonathan Yu ]

Modified: trunk/libhttp-server-simple-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-server-simple-perl/debian/control?rev=53407&op=diff
==============================================================================
--- trunk/libhttp-server-simple-perl/debian/control (original)
+++ trunk/libhttp-server-simple-perl/debian/control Sun Feb 28 17:30:44 2010
@@ -12,7 +12,7 @@
  Jose Luis Rivas <ghostbar38 at gmail.com>,
  Ansgar Burchardt <ansgar at 43-1.org>,
  Christine Spang <christine at debian.org>
-Standards-Version: 3.8.3
+Standards-Version: 3.8.4
 Homepage: http://search.cpan.org/dist/HTTP-Server-Simple/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libhttp-server-simple-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libhttp-server-simple-perl/

Modified: trunk/libhttp-server-simple-perl/lib/HTTP/Server/Simple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-server-simple-perl/lib/HTTP/Server/Simple.pm?rev=53407&op=diff
==============================================================================
--- trunk/libhttp-server-simple-perl/lib/HTTP/Server/Simple.pm (original)
+++ trunk/libhttp-server-simple-perl/lib/HTTP/Server/Simple.pm Sun Feb 28 17:30:44 2010
@@ -5,10 +5,9 @@
 use FileHandle;
 use Socket;
 use Carp;
-use URI::Escape;
 
 use vars qw($VERSION $bad_request_doc);
-$VERSION = '0.41';
+$VERSION = '0.42';
 
 =head1 NAME
 

Modified: trunk/libhttp-server-simple-perl/lib/HTTP/Server/Simple/CGI.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-server-simple-perl/lib/HTTP/Server/Simple/CGI.pm?rev=53407&op=diff
==============================================================================
--- trunk/libhttp-server-simple-perl/lib/HTTP/Server/Simple/CGI.pm (original)
+++ trunk/libhttp-server-simple-perl/lib/HTTP/Server/Simple/CGI.pm Sun Feb 28 17:30:44 2010
@@ -5,10 +5,12 @@
 use strict;
 use warnings;
 
-use CGI ();
+use vars qw($VERSION $default_doc $DEFAULT_CGI_INIT $DEFAULT_CGI_CLASS);
+$VERSION = $HTTP::Server::Simple::VERSION;
 
-use vars qw($VERSION $default_doc);
-$VERSION = $HTTP::Server::Simple::VERSION;
+$DEFAULT_CGI_CLASS = "CGI";
+$DEFAULT_CGI_INIT = sub { require CGI; CGI::initialize_globals()};
+
 
 =head1 NAME
 
@@ -43,8 +45,66 @@
 sub post_setup_hook {
     my $self = shift;
     $self->setup_server_url;
-    CGI::initialize_globals();
+    if ( my $init = $self->cgi_init ) {
+        $init->();
+    }
 }
+
+=head2 cgi_class [Classname]
+
+Gets or sets the class to use for creating the C<$cgi> object passed to
+C<handle_request>.
+
+Called with a single argument, it sets the coderef. Called with no arguments, 
+it returns this field's current value.
+
+To provide an initialization subroutine to be run in the post_setup_hook, 
+see L</cgi_init>.
+
+e.g.
+
+    $server->cgi_class('CGI');
+
+    $server->cgi_init(sub {
+        require CGI;
+        CGI::initialize_globals();
+    });
+
+or, if you want to use L<CGI::Simple>,
+
+    $server->cgi_class('CGI::Simple');
+    $server->cgi_init(sub {
+        require CGI::Simple;
+    });
+
+=cut
+
+sub cgi_class {
+    my $self = shift;
+    if (@_) {
+        $self->{cgi_class} = shift;
+    }
+    return $self->{cgi_class} || $DEFAULT_CGI_CLASS;
+}
+
+=head2 cgi_init [CODEREF]
+
+A coderef to run in the post_setup_hook.
+
+Called with a single argument, it sets the coderef. Called with no arguments, 
+it returns this field's current value.
+
+=cut
+
+sub cgi_init {
+    my $self = shift;
+    if (@_) {
+        $self->{cgi_init} = shift;
+    }
+    return $self->{cgi_init} || $DEFAULT_CGI_INIT;
+    
+}
+
 
 =head2 setup
 
@@ -89,7 +149,8 @@
 
 sub handler {
     my $self = shift;
-    my $cgi  = new CGI();
+    my $cgi;
+    $cgi = $self->cgi_class->new;
     eval { $self->handle_request($cgi) };
     if ($@) {
         my $error = $@;

Modified: trunk/libhttp-server-simple-perl/lib/HTTP/Server/Simple/CGI/Environment.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-server-simple-perl/lib/HTTP/Server/Simple/CGI/Environment.pm?rev=53407&op=diff
==============================================================================
--- trunk/libhttp-server-simple-perl/lib/HTTP/Server/Simple/CGI/Environment.pm (original)
+++ trunk/libhttp-server-simple-perl/lib/HTTP/Server/Simple/CGI/Environment.pm Sun Feb 28 17:30:44 2010
@@ -84,7 +84,7 @@
 
     # Apache and lighttpd both do one layer of unescaping on
     # path_info; we should duplicate that.
-    $ENV{PATH_INFO} = URI::Escape::uri_unescape($ENV{PATH_INFO});
+    $ENV{PATH_INFO} =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
 }
 
 =head2  header
@@ -102,7 +102,7 @@
     $tag =~ s/^COOKIES$/COOKIE/;
     $tag =~ s/-/_/g;
     $tag = "HTTP_" . $tag
-        unless $tag =~ m/^(?:CONTENT_(?:LENGTH|TYPE)|COOKIE)$/;
+        unless $tag =~ m/^CONTENT_(?:LENGTH|TYPE)$/;
 
     if ( exists $ENV{$tag} ) {
         $ENV{$tag} .= ", $value";

Modified: trunk/libhttp-server-simple-perl/t/04cgi.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-server-simple-perl/t/04cgi.t?rev=53407&op=diff
==============================================================================
--- trunk/libhttp-server-simple-perl/t/04cgi.t (original)
+++ trunk/libhttp-server-simple-perl/t/04cgi.t Sun Feb 28 17:30:44 2010
@@ -2,7 +2,7 @@
 use Socket;
 use strict;
 
-plan tests => 22;
+plan tests => 23;
 my $PORT = 40000 + int(rand(10000));
 
 my $host = gethostbyaddr(inet_aton('localhost'), AF_INET);
@@ -14,6 +14,7 @@
               server_port => 'server_port: '.$PORT,
               server_software => 'server_software: HTTP::Server::Simple/\d+.\d+',
               request_method => 'request_method: GET',
+              raw_cookie => undef, # do not test
             );
 
 my %envvars=(
@@ -42,6 +43,7 @@
   like(fetch("GET / HTTP/1.1",""), '/NOFILE/', 'no file');
 
   foreach my $method (keys(%methods)) {
+    next unless defined $methods{$method};
     like(
           fetch("GET /cgitest/$method HTTP/1.1",""),
           "/$methods{$method}/",
@@ -71,6 +73,11 @@
        "Did decode already"
       );
 
+  like(
+      fetch("GET /cgitest/raw_cookie HTTP/1.0","Cookie: foo=bar",""),
+      qr|foo=bar|,
+      "uses HTTP_COOKIE",
+  );
 
   is(kill(9,$pid),1,'Signaled 1 process successfully');
   wait or die "counldn't wait for sub-process completion";
@@ -135,7 +142,7 @@
     print "HTTP/1.0 200 OK\r\n";    # probably OK by now
     print "Content-Type: text/html\r\nContent-Length: ";
     my $response;
-    if($methods{$file}) {
+    if(exists $methods{$file}) {
       $response = "$file: ".$cgi->$file();
     } elsif($envvars{$file}) {
       $response="$file: $ENV{$file}";




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