This file documents the revision history for Perl extension HTTP::Request::AsCGI.
-1.0 2009-12-03
- - added test to check that $ENV is preserved after setup is called
-
1.0 2009-11-30
- Change how PATH_INFO is decoded so that everything is decoded, including
URI reserved characters (RT#50082)
+ - added test to check that %ENV is preserved after setup is called
+ - setup now concatenates its environment to %ENV instead of replacing it
0.9 2009-04-27
- unescape PATH_INFO more safely
{
no warnings 'uninitialized';
- %ENV = %{ $self->environment };
+ %ENV = %ENV, %{ $self->environment };
}
if ( $INC{'CGI.pm'} ) {
$headers .= $line;
last if $headers =~ /\x0d?\x0a\x0d?\x0a$/;
}
-
+
unless ( defined $headers ) {
$headers = "HTTP/1.1 500 Internal Server Error\x0d\x0a";
}
$response->code($code);
$response->message($message);
}
-
+
my $length = ( stat( $self->stdout ) )[7] - tell( $self->stdout );
if ( $response->code == 500 && !$length ) {
use CGI;
use HTTP::Request;
use HTTP::Request::AsCGI;
-
+
my $request = HTTP::Request->new( GET => 'http://www.host.com/' );
my $stdout;
-
+
{
my $c = HTTP::Request::AsCGI->new($request)->setup;
my $q = CGI->new;
-
+
print $q->header,
$q->start_html('Hello World'),
$q->h1('Hello World'),
$q->end_html;
-
+
$stdout = $c->stdout;
-
+
# environment and descriptors will automatically be restored
# when $c is destructed.
}
-
+
while ( my $line = $stdout->getline ) {
print $line;
}
-
+
=head1 DESCRIPTION
Provides a convenient way of setting up an CGI environment from an HTTP::Request.
=head1 METHODS
-=over 4
+=over 4
=item new ( $request [, key => value ] )
=item environment
-Returns a hashref containing the environment that will be used in setup.
+Returns a hashref containing the environment that will be used in setup.
Changing the hashref after setup has been called will have no effect.
=item setup