Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of git@github.com:miyagawa/Plack into impl-prefork

  • Loading branch information...
commit 0b8a70d461c51741820e5fedcd01cc0e125c975e 2 parents d9e4502 + c23530c
@kazuho kazuho authored
View
2  Makefile.PL
@@ -10,7 +10,7 @@ requires 'LWP'; # HTTP::Status, HTTP::Headers and HTTP::Request
requires 'HTTP::Body';
requires 'URI';
requires 'HTTP::Request::AsCGI';
-requires 'HTTP::Parser::XS', 0.02;
+requires 'HTTP::Parser::XS', 0.03;
requires 'CGI::Simple::Cookie'; # Plack::Response
requires 'Pod::Usage'; # plackup
View
3  eg/dot-psgi/frameworks/Maypole.psgi
@@ -1,4 +1,5 @@
use BeerDB;
use Maypole::PSGI;
-my $handler = sub { Maypole::PSGI->run('BeerDB', @_) };
+my $app = Maypole::PSGI->new('BeerDB');
+my $handler = sub { $app->run(@_) };
View
5 eg/dot-psgi/frameworks/Mojo.psgi
@@ -0,0 +1,5 @@
+use MyMojoApp;
+use Mojo::Server::PSGI;
+
+$ENV{MOJO_APP} = 'MyMojoApp';
+my $handler = sub { Mojo::Server::PSGI->new->run(@_) };
View
1  lib/Plack/HTTPParser/PP.pm
@@ -49,6 +49,7 @@ sub _parse_header {
$env->{REQUEST_METHOD} = $method;
$env->{SERVER_PROTOCOL} = "HTTP/$major.$minor";
+ $env->{REQUEST_URI} = $uri;
my($path, $query) = ( $uri =~ /^([^?]*)(?:\?(.*))?$/s );
$env->{PATH_INFO} = URI::Escape::uri_unescape($path);
View
2  lib/Plack/Server/CGI.pm
@@ -10,7 +10,7 @@ sub run {
my ($self, $app) = @_;
my %env;
while (my ($k, $v) = each %ENV) {
- next unless $k =~ qr/^(?:REQUEST_METHOD|SCRIPT_NAME|PATH_INFO|QUERY_STRING|SERVER_NAME|SERVER_PORT|SERVER_PROTOCOL|CONTENT_LENGTH|CONTENT_TYPE|REMOTE_ADDR)$|^HTTP_/;
+ next unless $k =~ qr/^(?:REQUEST_METHOD|SCRIPT_NAME|PATH_INFO|QUERY_STRING|SERVER_NAME|SERVER_PORT|SERVER_PROTOCOL|CONTENT_LENGTH|CONTENT_TYPE|REMOTE_ADDR|REQUEST_URI)$|^HTTP_/;
$env{$k} = $v;
}
$env{'HTTP_COOKIE'} ||= $ENV{COOKIE};
View
61 lib/Plack/Server/FCGI.pm
@@ -126,3 +126,64 @@ sub daemon_detach {
}
1;
+
+__END__
+
+=head1 SYNOPSIS
+
+ my $server = Plack::Server::FCGI->new(
+ nproc => $num_proc,
+ listen => $listen,
+ detach => 1,
+ );
+ $server->run($app);
+
+Starts the FastCGI server. If C<$listen> is set, then it specifies a
+location to listen for FastCGI requests;
+
+=head2 OPTIONS
+
+=over 4
+
+=item listen
+
+ listen => '/path/to/socket'
+ listen => ':8080'
+
+Listen on a socket path, hostname:port, or :port.
+
+=item port
+
+listen via TCP on port on all interfaces (Same as C<< listen => ":$port" >>)
+
+=item leave_umask
+
+Set to 1 to disable setting umask to 0 for socket open
+
+=item nointr
+
+Do not allow the listener to be interrupted by Ctrl+C
+
+=item nproc
+
+Specify a number of processes for FCGI::ProcManager
+
+=item pidfile
+
+Specify a filename for the pid file
+
+=item manager
+
+Specify a FCGI::ProcManager sub-class
+
+=item detach
+
+Detach from console
+
+=item keep_stderr
+
+Send STDERR to STDOUT instead of the webserver
+
+=back
+
+=cut
View
2  lib/Plack/Server/Mojo.pm
@@ -3,6 +3,7 @@ use strict;
use warnings;
use base qw(Mojo::Base);
use Plack::Util;
+use URI;
use URI::Escape;
__PACKAGE__->attr([ 'host', 'port' ]);
@@ -39,6 +40,7 @@ sub handler {
my %env;
$env{REQUEST_METHOD} = $tx->req->method;
$env{SCRIPT_NAME} = "";
+ $env{REQUEST_URI} = URI->new($tx->req->url)->path_query;
$env{PATH_INFO} = URI::Escape::uri_unescape($tx->req->url->path);
$env{QUERY_STRING} = $tx->req->url->query->to_string;
$env{SERVER_NAME} = $mojo_daemon->address;
View
2  lib/Plack/Server/ServerSimple.pm
@@ -33,7 +33,7 @@ sub handler {
my %env;
while (my ($k, $v) = each %ENV) {
- next unless $k =~ qr/^(?:REQUEST_METHOD|PATH_INFO|QUERY_STRING|SERVER_NAME|SERVER_PORT|SERVER_PROTOCOL|CONTENT_LENGTH|CONTENT_TYPE|REMOTE_ADDR)$|^HTTP_/;
+ next unless $k =~ qr/^(?:REQUEST_METHOD|PATH_INFO|QUERY_STRING|REQUEST_URI|SERVER_NAME|SERVER_PORT|SERVER_PROTOCOL|CONTENT_LENGTH|CONTENT_TYPE|REMOTE_ADDR)$|^HTTP_/;
$env{$k} = $v;
}
$env{'CONTENT_LENGTH'} = $ENV{CONTENT_LENGTH};
View
17 lib/Plack/Test/Suite.pm
@@ -446,6 +446,23 @@ our @TEST = (
ok ! defined $res->header('transfer_encoding'), "No Transfer-Encoding";
},
],
+ [
+ 'REQUEST_URI is set',
+ sub {
+ my $port = $_[0] || 80;
+ HTTP::Request->new(
+ GET => "http://127.0.0.1:$port/foo/bar%20baz?x=a",
+ );
+ },
+ sub {
+ my $env = shift;
+ return [ 200, [ 'Content-Type' => 'text/plain' ], [ $env->{REQUEST_URI} ] ];
+ },
+ sub {
+ my $res = shift;
+ is $res->content, '/foo/bar%20baz?x=a';
+ },
+ ],
);
for my $test (@TEST) {
Please sign in to comment.
Something went wrong with that request. Please try again.