diff --git a/Changes b/Changes index b6c63ec300..e7cec9c9cb 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ This file documents the revision history for Perl extension Mojolicious. 1.98 2011-09-11 00:00:00 + - Removed Mojo::Server::FastCGI so it can be maintained as a separate + distribution. - Added EXPERIMENTAL mojo_lib_dir and slurp_rel_file methods to Mojo::Home. - Improved host condition to work in more environments. diff --git a/README.pod b/README.pod index 8e41197334..258b867906 100644 --- a/README.pod +++ b/README.pod @@ -45,7 +45,7 @@ perfect for embedding. =item * -Automatic CGI, FastCGI and L detection. +Automatic CGI and L detection. =item * diff --git a/lib/Mojo.pm b/lib/Mojo.pm index 7e0377c01b..14846aecb1 100644 --- a/lib/Mojo.pm +++ b/lib/Mojo.pm @@ -55,8 +55,8 @@ Mojo - The Duct Tape! use Mojo::Base 'Mojo'; - # All the complexities of CGI, FastCGI, PSGI, HTTP and WebSockets get - # reduced to a single method call! + # All the complexities of CGI, PSGI, HTTP and WebSockets get reduced to a + # single method call! sub handler { my ($self, $tx) = @_; diff --git a/lib/Mojo/Command.pm b/lib/Mojo/Command.pm index 0c5c7959d9..37c0034a65 100644 --- a/lib/Mojo/Command.pm +++ b/lib/Mojo/Command.pm @@ -20,8 +20,8 @@ has description => 'No description.'; has message => <<"EOF"; usage: $0 COMMAND [OPTIONS] -Tip: CGI, FastCGI and PSGI environments can be automatically detected very - often and work without commands. +Tip: CGI and PSGI environments can be automatically detected very often and + work without commands. These commands are currently available: EOF @@ -94,16 +94,8 @@ sub detect { return 'cgi' if defined $ENV{PATH_INFO} || defined $ENV{GATEWAY_INTERFACE}; - # No further detection if we have a guess - return $guess if $guess; - - # FastCGI (detect absence of WINDIR for Windows and USER for UNIX) - return 'fastcgi' - if !defined $ENV{WINDIR} - && !defined $ENV{USER} - && !defined $ENV{HARNESS_ACTIVE}; - # Nothing + return $guess if $guess; return; } diff --git a/lib/Mojo/Server/FastCGI.pm b/lib/Mojo/Server/FastCGI.pm deleted file mode 100644 index e9be0e7c33..0000000000 --- a/lib/Mojo/Server/FastCGI.pm +++ /dev/null @@ -1,506 +0,0 @@ -package Mojo::Server::FastCGI; -use Mojo::Base 'Mojo::Server'; - -use Errno qw/EAGAIN EINTR EWOULDBLOCK/; -use IO::Socket; - -use constant DEBUG => $ENV{MOJO_FASTCGI_DEBUG} || 0; - -# Roles -my @ROLES = qw/RESPONDER AUTHORIZER FILTER/; -my %ROLE_NUMBERS; -{ - my $i = 1; - for my $role (@ROLES) { - $ROLE_NUMBERS{$role} = $i; - $i++; - } -} - -# Types -my @TYPES = qw/ - BEGIN_REQUEST - ABORT_REQUEST - END_REQUEST - PARAMS - STDIN - STDOUT - STDERR - DATA - GET_VALUES - GET_VALUES_RESULT - UNKNOWN_TYPE - /; -my %TYPE_NUMBERS; -{ - my $i = 1; - for my $type (@TYPES) { - $TYPE_NUMBERS{$type} = $i; - $i++; - } -} - -# "Wow! Homer must have got one of those robot cars! -# *Car crashes in background* -# Yeah, one of those AMERICAN robot cars." -sub accept_connection { - my $self = shift; - - # Listen socket - unless ($self->{listen}) { - my $listen = IO::Socket->new; - - # Open - unless ($listen->fdopen(0, 'r')) { - $self->app->log->error("Can't open FastCGI socket fd0: $!"); - return; - } - - $self->{listen} = $listen; - } - $self->app->log->debug('FastCGI listen socket opened.') if DEBUG; - - # Accept - my $c; - unless ($c = $self->{listen}->accept) { - $self->app->log->error("Can't accept FastCGI connection: $!"); - return; - } - $self->app->log->debug('Accepted FastCGI connection.') if DEBUG; - - return $c; -} - -sub read_record { - my ($self, $c) = @_; - return unless $c; - - # Header - my $header = $self->_read_chunk($c, 8); - return unless $header; - my ($version, $type, $id, $clen, $plen) = unpack 'CCnnC', $header; - - # Body - my $body = $self->_read_chunk($c, $clen + $plen); - - # No content, just paddign bytes - $body = undef unless $clen; - - # Ignore padding bytes - $body = $plen ? substr($body, 0, $clen, '') : $body; - - if (DEBUG) { - my $t = $self->type_name($type); - $self->app->log->debug( - qq/Reading FastCGI record: $type - $id - "$body"./); - } - - return $self->type_name($type), $id, $body; -} - -sub read_request { - my ($self, $c) = @_; - $self->app->log->debug('Reading FastCGI request.') if DEBUG; - - # Transaction - my $tx = $self->on_transaction->($self); - $tx->connection($c); - my $req = $tx->req; - - # Type - my ($type, $id, $body) = $self->read_record($c); - unless ($type && $type eq 'BEGIN_REQUEST') { - $self->app->log->error("First FastCGI record wasn't a begin request."); - return; - } - $ENV{FCGI_ID} = $tx->{fcgi_id} = $id; - - # Role/Flags - my ($role, $flags) = unpack 'nC', $body; - $ENV{FCGI_ROLE} = $tx->{fcgi_role} = $self->role_name($role); - - # Slurp - my $buffer = ''; - my $env = {}; - while (($type, $id, $body) = $self->read_record($c)) { - - # Wrong id - next unless $id == $tx->{fcgi_id}; - - # Params - if ($type eq 'PARAMS') { - - # Normal param chunk - if ($body) { - $buffer .= $body; - next; - } - - # Params done - while (length $buffer) { - - # Name and value length - my $name_len = $self->_nv_length(\$buffer); - my $value_len = $self->_nv_length(\$buffer); - - # Name and value - my $name = substr $buffer, 0, $name_len, ''; - my $value = substr $buffer, 0, $value_len, ''; - - # Environment - $env->{$name} = $value; - $self->app->log->debug(qq/FastCGI param: $name - "$value"./) - if DEBUG; - - # Store connection information - $tx->remote_address($value) if $name =~ /REMOTE_ADDR/i; - $tx->local_port($value) if $name =~ /SERVER_PORT/i; - } - } - - # Stdin - elsif ($type eq 'STDIN') { - - # Environment - if (keys %$env) { - $req->parse($env); - $env = {}; - } - - # EOF - last unless $body; - - # Chunk - $req->parse($body); - - # Error - return $tx if $req->error; - } - } - - return $tx; -} - -sub role_name { - my ($self, $role) = @_; - return unless $role; - return $ROLES[$role - 1]; -} - -sub role_number { - my ($self, $role) = @_; - return unless $role; - return $ROLE_NUMBERS{uc $role}; -} - -sub run { - my $self = shift; - - # Preload application - $self->app; - - # New incoming request - while (my $c = $self->accept_connection) { - - # Request - my $tx = $self->read_request($c); - - # Error - unless ($tx) { - $self->app->log->error("No transaction for FastCGI request."); - next; - } - - # Handle - $self->app->log->debug('Handling FastCGI request.') if DEBUG; - $self->on_request->($self, $tx); - - # Response - $self->write_response($tx); - - # Finish transaction - $tx->on_finish->($tx); - } -} - -sub type_name { - my ($self, $type) = @_; - return unless $type; - return $TYPES[$type - 1]; -} - -sub type_number { - my ($self, $type) = @_; - return unless $type; - return $TYPE_NUMBERS{uc $type}; -} - -sub write_records { - my ($self, $c, $type, $id, $body) = @_; - return unless defined $c && defined $type && defined $id; - $body ||= ''; - - # Write records - my $empty = $body ? 0 : 1; - my $offset = 0; - my $body_len = length $body; - while (($body_len > 0) || $empty) { - - # Need to split content - my $payload_len = $body_len > 32 * 1024 ? 32 * 1024 : $body_len; - my $pad_len = (8 - ($payload_len % 8)) % 8; - - # FCGI version 1 record - my $template = "CCnnCxa${payload_len}x$pad_len"; - - if (DEBUG) { - my $chunk = substr($body, $offset, $payload_len); - $self->app->log->debug( - qq/Writing FastCGI record: $type - $id - "$chunk"./); - } - - # Write whole record - my $record = pack $template, 1, $self->type_number($type), $id, - $payload_len, - $pad_len, - substr($body, $offset, $payload_len); - my $woffset = 0; - while ($woffset < length $record) { - my $written = $c->syswrite($record, undef, $woffset); - - # Error - unless (defined $written) { - - # Retry - next if $! == EAGAIN || $! == EINTR || $! == EWOULDBLOCK; - - # Write error - return; - } - - $woffset += $written; - } - $body_len -= $payload_len; - $offset += $payload_len; - - # Done - last if $empty; - } - - return 1; -} - -sub write_response { - my ($self, $tx) = @_; - $self->app->log->debug('Writing FastCGI response.') if DEBUG; - - # Status - my $res = $tx->res; - my $code = $res->code || 404; - my $message = $res->message || $res->default_message; - $res->headers->status("$code $message") unless $res->headers->status; - - # Fix headers - $res->fix_headers; - - # Headers - my $c = $tx->connection; - my $offset = 0; - while (1) { - my $chunk = $res->get_header_chunk($offset); - - # No headers yet, try again - unless (defined $chunk) { - sleep 1; - next; - } - - # End of headers - last unless length $chunk; - - # Headers - $offset += length $chunk; - return - unless $self->write_records($c, 'STDOUT', $tx->{fcgi_id}, $chunk); - } - - # Body - $offset = 0; - while (1) { - my $chunk = $res->get_body_chunk($offset); - - # No content yet, try again - unless (defined $chunk) { - sleep 1; - next; - } - - # End of content - last unless length $chunk; - - # Content - $offset += length $chunk; - return - unless $self->write_records($c, 'STDOUT', $tx->{fcgi_id}, $chunk); - } - - # The end - return - unless $self->write_records($c, 'STDOUT', $tx->{fcgi_id}, undef); - return - unless $self->write_records($c, 'END_REQUEST', $tx->{fcgi_id}, - pack('CCCCCCCC', 0)); -} - -sub _nv_length { - my ($self, $bodyref) = @_; - - # Try first byte - my $len = unpack 'C', substr($$bodyref, 0, 1, ''); - - # 4 byte length - if ($len & 0x80) { - $len = pack 'C', $len & 0x7F; - substr $len, 1, 0, substr($$bodyref, 0, 3, ''); - $len = unpack 'N', $len; - } - - return $len; -} - -sub _read_chunk { - my ($self, $c, $len) = @_; - - # Read - my $chunk = ''; - while (length $chunk < $len) { - my $read = $c->sysread(my $buffer, $len - length $chunk, 0); - unless (defined $read) { - next if $! == EAGAIN || $! == EINTR || $! == EWOULDBLOCK; - last; - } - last unless $read; - $chunk .= $buffer; - } - - return $chunk; -} - -1; -__END__ - -=head1 NAME - -Mojo::Server::FastCGI - FastCGI Server - -=head1 SYNOPSIS - - use Mojo::Server::FastCGI; - - my $fcgi = Mojo::Server::FastCGI->new; - $fcgi->on_request(sub { - my ($self, $tx) = @_; - - # Request - my $method = $tx->req->method; - my $path = $tx->req->url->path; - - # Response - $tx->res->code(200); - $tx->res->headers->content_type('text/plain'); - $tx->res->body("$method request for $path!"); - - # Resume transaction - $tx->resume; - }); - $fcgi->run; - -=head1 DESCRIPTION - -L is a portable pure-Perl FastCGI implementation as -described in the C. - -See L for deployment recipes. - -=head1 ATTRIBUTES - -L inherits all attributes from L. - -=head1 METHODS - -L inherits all methods from L and -implements the following new ones. - -=head2 C - - my $c = $fcgi->accept_connection; - -Accept FastCGI connection. - -=head2 C - - my ($type, $id, $body) = $fcgi->read_record($c); - -Parse FastCGI record. - -=head2 C - - my $tx = $fcgi->read_request($c); - -Parse FastCGI request. - -=head2 C - - my $name = $fcgi->role_name(3); - -FastCGI role name. - -=head2 C - - my $number = $fcgi->role_number('FILTER'); - -FastCGI role number. - -=head2 C - - $fcgi->run; - -Start FastCGI. - -=head2 C - - my $name = $fcgi->type_name(5); - -FastCGI type name. - -=head2 C - - my $number = $fcgi->type_number('STDIN'); - -FastCGI type number. - -=head2 C - - $fcgi->write_record($c, 'STDOUT', $id, 'HTTP/1.1 200 OK'); - -Write FastCGI record. - -=head2 C - - $fcgi->write_response($tx); - -Write FastCGI response. - -=head1 DEBUGGING - -You can set the C environment variable to get some -advanced diagnostics information sent to the L logger as C -messages. - - MOJO_FASTCGI_DEBUG=1 - -=head1 SEE ALSO - -L, L, L. - -=cut diff --git a/lib/Mojo/Server/PSGI.pm b/lib/Mojo/Server/PSGI.pm index d45f059086..96ee97e8f5 100644 --- a/lib/Mojo/Server/PSGI.pm +++ b/lib/Mojo/Server/PSGI.pm @@ -57,6 +57,9 @@ sub run { return [$code, \@headers, $body]; } +# "Wow! Homer must have got one of those robot cars! +# *Car crashes in background* +# Yeah, one of those AMERICAN robot cars." package Mojo::Server::PSGI::_Handle; use Mojo::Base -base; diff --git a/lib/Mojo/Util.pm b/lib/Mojo/Util.pm index 7437b674b1..f587303ce6 100644 --- a/lib/Mojo/Util.pm +++ b/lib/Mojo/Util.pm @@ -604,6 +604,7 @@ sub url_escape { $_[0] =~ s/([^$pattern])/sprintf('%%%02X',ord($1))/ge; } +# "I've gone back in time to when dinosaurs weren't just confined to zoos." sub url_unescape { return if index($_[0], '%') == -1; $_[0] =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge; diff --git a/lib/Mojolicious.pm b/lib/Mojolicious.pm index d6f06f5b8f..4cbf00e10b 100644 --- a/lib/Mojolicious.pm +++ b/lib/Mojolicious.pm @@ -12,6 +12,7 @@ use Mojolicious::Static; use Mojolicious::Types; use Scalar::Util 'weaken'; +# "Robots don't have any emotions, and sometimes that makes me very sad." has controller_class => 'Mojolicious::Controller'; has mode => sub { ($ENV{MOJO_MODE} || 'development') }; has on_process => sub { @@ -402,26 +403,6 @@ workflow. Take a look at our excellent documentation in L! -=head1 ARCHITECTURE - -Loosely coupled building blocks, use what you like and just ignore the rest. - - .---------------------------------------------------------------. - | | - | .----------------------------------------------' - | | .--------------------------------------------. - | Application | | Mojolicious::Lite | - | | '--------------------------------------------' - | | .--------------------------------------------. - | | | Mojolicious | - '----------------' '--------------------------------------------' - .---------------------------------------------------------------. - | Mojo | - '---------------------------------------------------------------' - .-------. .-----------. .--------. .------------. .-------------. - | CGI | | FastCGI | | PSGI | | HTTP 1.1 | | WebSocket | - '-------' '-----------' '--------' '------------' '-------------' - =head1 ATTRIBUTES L inherits all attributes from L and implements the diff --git a/lib/Mojolicious/Command/fastcgi.pm b/lib/Mojolicious/Command/fastcgi.pm deleted file mode 100644 index c44a5017a8..0000000000 --- a/lib/Mojolicious/Command/fastcgi.pm +++ /dev/null @@ -1,69 +0,0 @@ -package Mojolicious::Command::fastcgi; -use Mojo::Base 'Mojo::Command'; - -use Mojo::Server::FastCGI; - -has description => <<'EOF'; -Start application with FastCGI. -EOF -has usage => <<"EOF"; -usage: $0 fastcgi -EOF - -# "Interesting... Oh no wait, the other thing, tedious." -sub run { Mojo::Server::FastCGI->new->run } - -1; -__END__ - -=head1 NAME - -Mojolicious::Command::fastcgi - FastCGI Command - -=head1 SYNOPSIS - - use Mojolicious::Command::fastcgi; - - my $fastcgi = Mojolicious::Command::fastcgi->new; - $fastcgi->run; - -=head1 DESCRIPTION - -L is a command interface to -L. - -=head1 ATTRIBUTES - -L inherits all attributes from -L and implements the following new ones. - -=head2 C - - my $description = $fastcgi->description; - $fastcgi = $fastcgi->description('Foo!'); - -Short description of this command, used for the command list. - -=head2 C - - my $usage = $fastcgi->usage; - $fastcgi = $fastcgi->usage('Foo!'); - -Usage information for this command, used for the help screen. - -=head1 METHODS - -L inherits all methods from L -and implements the following new ones. - -=head2 C - - $fastcgi->run; - -Run this command. - -=head1 SEE ALSO - -L, L, L. - -=cut diff --git a/lib/Mojolicious/Commands.pm b/lib/Mojolicious/Commands.pm index 9896497d23..b74f9a1e96 100644 --- a/lib/Mojolicious/Commands.pm +++ b/lib/Mojolicious/Commands.pm @@ -85,13 +85,6 @@ Start application with standalone HTTP 1.1 server backend. Run code against application. -=head2 C - - $ mojo fastcgi - $ script/myapp fastcgi - -Start application with FastCGI backend. - =head2 C $ mojo generate diff --git a/lib/Mojolicious/Guides.pod b/lib/Mojolicious/Guides.pod index 1e9bac2d19..dcf1f392b1 100644 --- a/lib/Mojolicious/Guides.pod +++ b/lib/Mojolicious/Guides.pod @@ -92,9 +92,9 @@ Full featured UNIX optimized preforking non-blocking I/O HTTP 1.1 and WebSocket server with support for zero downtime software upgrades (hot deployment). -=item L, L, L +=item L, L -Transparent CGI, FastCGI and PSGI support out of the box. +Transparent CGI and PSGI support out of the box. =item L diff --git a/lib/Mojolicious/Guides/Cookbook.pod b/lib/Mojolicious/Guides/Cookbook.pod index ec7f002e4c..5dd1d2661c 100644 --- a/lib/Mojolicious/Guides/Cookbook.pod +++ b/lib/Mojolicious/Guides/Cookbook.pod @@ -120,16 +120,6 @@ automatically detect that it is executed as a C script. ScriptAlias / /home/sri/myapp/script/myapp/ -=head2 Apache/FastCGI - -C is also supported out of the box and your L -application will automatically detect that it is executed as a C -script. - - FastCgiIpcDir /home/sri/myapp - FastCgiServer /home/sri/myapp/script/myapp -processes 1 - Alias / /home/sri/myapp/script/myapp/ - =head2 PSGI/Plack L is an interface between Perl web frameworks and web servers, and diff --git a/lib/Mojolicious/Lite.pm b/lib/Mojolicious/Lite.pm index 9d8c26ac78..511e97acea 100644 --- a/lib/Mojolicious/Lite.pm +++ b/lib/Mojolicious/Lite.pm @@ -120,8 +120,8 @@ There is also a helper command to generate a small example application. =head2 Commands All the normal L are available from the command line. -Note that CGI, FastCGI and PSGI environments can usually be auto detected and -will just work without commands. +Note that CGI and PSGI environments can usually be auto detected and will +just work without commands. $ ./myapp.pl daemon Server available at http://127.0.0.1:3000. @@ -132,9 +132,6 @@ will just work without commands. $ ./myapp.pl cgi ...CGI output... - $ ./myapp.pl fastcgi - ...Blocking FastCGI main loop... - $ ./myapp.pl ...List of available commands (or automatically detected environment)... diff --git a/lib/Mojolicious/Routes/Pattern.pm b/lib/Mojolicious/Routes/Pattern.pm index 64f80f3a2d..2f476aab46 100644 --- a/lib/Mojolicious/Routes/Pattern.pm +++ b/lib/Mojolicious/Routes/Pattern.pm @@ -200,6 +200,7 @@ sub _compile { return $regex; } +# "Interesting... Oh no wait, the other thing, tedious." sub _compile_req { my $req = shift; return "($req)" if !ref $req || ref $req ne 'ARRAY'; diff --git a/t/mojo/apache_fastcgi.t b/t/mojo/apache_fastcgi.t deleted file mode 100644 index eb0c1dc21b..0000000000 --- a/t/mojo/apache_fastcgi.t +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/env perl -use Mojo::Base -strict; - -# Disable Bonjour, IPv6 and libev -BEGIN { - $ENV{MOJO_NO_BONJOUR} = $ENV{MOJO_NO_IPV6} = 1; - $ENV{MOJO_IOWATCHER} = 'Mojo::IOWatcher'; -} - -# mod_fastcgi doesn't like small chunks -BEGIN { $ENV{MOJO_CHUNK_SIZE} = 131072 } - -use Test::More; - -use File::Spec; -use File::Temp; -use IO::Socket::INET; -use Mojo::IOLoop; -use Mojo::Template; -use Mojo::UserAgent; - -# Mac OS X only test -plan skip_all => 'Mac OS X required for this test!' unless $^O eq 'darwin'; -plan skip_all => 'set TEST_APACHE to enable this test (developer only!)' - unless $ENV{TEST_APACHE}; -plan tests => 12; - -# "Robots don't have any emotions, and sometimes that makes me very sad." -use_ok 'Mojo::Server::FastCGI'; - -# Setup -my $port = Mojo::IOLoop->generate_port; -my $dir = File::Temp::tempdir(CLEANUP => 1); -my $config = File::Spec->catfile($dir, 'fcgi.config'); -my $mt = Mojo::Template->new; - -# FastCGI setup -my $fcgi = File::Spec->catfile($dir, 'test.fcgi'); -$mt->render_to_file(<<'EOF', $fcgi); -#!/usr/bin/env perl - -use strict; -use warnings; - -% use FindBin; -use lib '<%= "$FindBin::Bin/../../lib" %>'; - -use Mojo::Server::FastCGI; - -Mojo::Server::FastCGI->new->run; - -1; -EOF -chmod 0777, $fcgi; -ok -x $fcgi, 'script is executable'; - -# Apache setup -$mt->render_to_file(<<'EOF', $config, $dir, $port, $fcgi); -% my ($dir, $port, $fcgi) = @_; -% use File::Spec; -ServerName 127.0.0.1 -Listen <%= $port %> -DocumentRoot <%= $dir %> - -LoadModule log_config_module libexec/apache2/mod_log_config.so - -ErrorLog <%= File::Spec->catfile($dir, 'error.log') %> - -LoadModule alias_module libexec/apache2/mod_alias.so -LoadModule fastcgi_module libexec/apache2/mod_fastcgi.so - -PidFile <%= File::Spec->catfile($dir, 'httpd.pid') %> -LockFile <%= File::Spec->catfile($dir, 'accept.lock') %> - -FastCgiIpcDir <%= $dir %> -FastCgiServer <%= $fcgi %> -processes 1 -Alias / <%= $fcgi %>/ -EOF - -# Start -my $pid = open my $server, '-|', '/usr/sbin/httpd', '-X', '-f', $config; -sleep 1 - while !IO::Socket::INET->new( - Proto => 'tcp', - PeerAddr => 'localhost', - PeerPort => $port - ); - -# Request -my $ua = Mojo::UserAgent->new; -my $tx = $ua->get("http://127.0.0.1:$port/"); -is $tx->res->code, 200, 'right status'; -is $tx->res->headers->content_length, 21, 'right "Content-Length" value'; -is $tx->res->body, 'Your Mojo is working!', 'right content'; - -# HEAD request -$tx = $ua->head("http://127.0.0.1:$port/"); -is $tx->res->code, 200, 'right status'; -is $tx->res->headers->content_length, 21, 'right "Content-Length" value'; -is $tx->res->body, '', 'no content'; - -# Form with chunked response -my $params = {}; -for my $i (1 .. 10) { $params->{"test$i"} = $i } -my $result = ''; -for my $key (sort keys %$params) { $result .= $params->{$key} } -my ($code, $body); -$tx = $ua->post_form("http://127.0.0.1:$port/diag/chunked_params" => $params); -is $tx->res->code, 200, 'right status'; -is $tx->res->body, $result, 'right content'; - -# Upload -($code, $body) = undef; -$tx = $ua->post_form( - "http://127.0.0.1:$port/diag/upload" => {file => {content => $result}}); -is $tx->res->code, 200, 'right status'; -is $tx->res->body, $result, 'right content'; - -# Stop -kill 'INT', $pid; -sleep 1 - while IO::Socket::INET->new( - Proto => 'tcp', - PeerAddr => 'localhost', - PeerPort => $port - ); diff --git a/t/mojo/command.t b/t/mojo/command.t index 0a898cc0ea..31125d611f 100644 --- a/t/mojo/command.t +++ b/t/mojo/command.t @@ -1,7 +1,7 @@ #!/usr/bin/env perl use Mojo::Base -strict; -use Test::More tests => 24; +use Test::More tests => 23; use Cwd 'cwd'; use File::Spec; @@ -67,10 +67,6 @@ is $command->class_to_path('Foo::Bar'), 'Foo/Bar.pm', 'right path'; local $ENV{GATEWAY_INTERFACE} = 'CGI/1.1'; is $command->detect, 'cgi', 'right environment'; } -{ - local %ENV = (); - is $command->detect, 'fastcgi', 'right environment'; -} # Generating files my $cwd = cwd; diff --git a/t/mojo/fastcgi.t b/t/mojo/fastcgi.t deleted file mode 100644 index c163fce2b2..0000000000 --- a/t/mojo/fastcgi.t +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env perl -use Mojo::Base -strict; - -use Test::More tests => 1; - -# "I've gone back in time to when dinosaurs weren't just confined to zoos." -use_ok 'Mojo::Server::FastCGI';