This file documents the revision history for Perl extension HTTP::Request::AsCGI.
-0.4 2006-01-06 00:00:00 2005
+0.5 2006-01-20 00:00:00 2005
+ - Fixed bug where content was overridden on 500 responses.
+
+0.4 2006-01-19 00:00:00 2005
- Fixed #15999 return a 500 response when message is empty, reported by Chris Dolan <cdolan@cpan.org>
- Fixed Status header bug
- Bumped HTTP::Response requirement to 1.53 and drop our own message parsing.
__PACKAGE__->mk_accessors(qw[ enviroment request stdin stdout stderr ]);
-our $VERSION = 0.4;
+our $VERSION = 0.5;
sub new {
my $class = shift;
$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 && !$response->content ) {
+ if ( $response->code == 500 && !$length ) {
$response->content( $response->error_as_HTML );
$response->content_type('text/html');
#!perl
-use Test::More tests => 6;
+use Test::More tests => 12;
use strict;
use warnings;
is( $response->protocol, 'HTTP/1.1', 'Response Protocol' );
is( $response->content_type, 'text/html', 'Response Content-Type' );
ok( length($response->content) > 0, 'Response Content' );
+
+{
+ my $r = HTTP::Request->new( GET => 'http://www.host.com/' );
+ my $c = HTTP::Request::AsCGI->new($r);
+
+ $c->setup;
+
+ print "Content-Type: text/plain\n";
+ print "Status: 500 Borked\n";
+ print "\n";
+ print "Borked!";
+
+ $response = $c->restore->response;
+}
+
+isa_ok( $response, 'HTTP::Response' );
+is( $response->code, 500, 'Response Code' );
+is( $response->message, 'Borked', 'Response Message' );
+is( $response->protocol, 'HTTP/1.1', 'Response Protocol' );
+is( $response->content_type, 'text/plain', 'Response Content-Type' );
+is( $response->content, 'Borked!', 'Response Content' );