Server/Patch/HTTPServerSimple.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 34 CC 4 SCAR 24.0
CC
4
Cov
0%
HTTP::Server::Simple::CGI::Environment::header
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 11.0
1 package RPC::ExtDirect::Server::Patch::HTTPServerSimple;
2  
3 use strict;
4 use warnings;
5 no warnings 'redefine';
6  
7 # This monkey patching is required for HTTP::Server::Simple <= 0.51;
8 # CGI.pm < 3.36 does not support HTTP_COOKIE environment variable with
9 # multiple values separated by commas instead of semicolons.
10 #
11 # The code is copied from HTTP::Server::Simple::CGI::Environment,
12 # with a fix applied.
13  
14 use HTTP::Server::Simple::CGI::Environment;
15  
16 sub HTTP::Server::Simple::CGI::Environment::header {
17 my $self = shift;
18 my $tag = shift;
19 my $value = shift;
20  
21 $tag = uc($tag);
22 $tag =~ s/^COOKIES$/COOKIE/;
23 $tag =~ s/-/_/g;
24 $tag = "HTTP_" . $tag
25 unless $tag =~ m/^CONTENT_(?:LENGTH|TYPE)$/;
26  
27 if ( exists $ENV{$tag} ) {
28 # This line is fixed
29 $ENV{$tag} .= $tag eq 'HTTP_COOKIE' ? "; $value" : ", $value";
30 }
31 else {
32 $ENV{$tag} = $value;
33 }
34 }
35  
36 1;
37