From: Christian Hansen Date: Sun, 16 Oct 2005 16:05:58 +0000 (+0000) Subject: Fixed field -> env bug X-Git-Tag: v1.0~54 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FHTTP-Request-AsCGI.git;a=commitdiff_plain;h=2aaf55bcc25c7c95a5e5783d17c22157c600b178 Fixed field -> env bug --- diff --git a/examples/daemon.pl b/examples/daemon.pl index 5a16c89..a861906 100644 --- a/examples/daemon.pl +++ b/examples/daemon.pl @@ -25,6 +25,8 @@ while ( my $client = $server->accept ) { while ( my $request = $client->get_request ) { + CGI::initialize_globals(); + my $c = HTTP::Request::AsCGI->new( $request, %e )->setup; my $q = CGI->new; diff --git a/lib/HTTP/Request/AsCGI.pm b/lib/HTTP/Request/AsCGI.pm index ccae2b4..31279fe 100644 --- a/lib/HTTP/Request/AsCGI.pm +++ b/lib/HTTP/Request/AsCGI.pm @@ -44,7 +44,7 @@ sub new { foreach my $field ( $request->headers->header_field_names ) { my $key = uc($field); - $key =~ tr/_/-/; + $key =~ tr/-/_/; $key = 'HTTP_' . $key unless $field =~ /^Content-(Length|Type)$/; unless ( exists $self->{enviroment}->{$key} ) {