Fixed field -> env bug
Christian Hansen [Sun, 16 Oct 2005 16:05:58 +0000 (16:05 +0000)]
examples/daemon.pl
lib/HTTP/Request/AsCGI.pm

index 5a16c89..a861906 100644 (file)
@@ -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;
 
index ccae2b4..31279fe 100644 (file)
@@ -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} ) {