lib/SOAP/Transport/HTTP.pm

filter: Statementstmt 66.8% 278 / 416 Branchbran 43.0% 93 / 216 Conditioncond 33.5% 58 / 173 MC/DCmcdc 4.5% 4 / 88 Subroutinesub 80.7% 46 / 57 Podpod n/a totaltotal 50.4% 479 / 950 CC 174 SCAR 42.8
CC
174
Cov
53%
send_receive
177.7
handle
127.1
handler
110.0
CRAP 72.1
« lib/SOAP/Test.pm ↑ Summary lib/SOAP/Transport/POP3.pm »
1 # ======================================================================
2 #
3 # Copyright (C) 2000-2004 Paul Kulchenko (paulclinger@yahoo.com)
4 # SOAP::Lite is free software; you can redistribute it
5 # and/or modify it under the same terms as Perl itself.
6 #
7 # ======================================================================
8  
9 package SOAP::Transport::HTTP;
10  
11 17 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 17 our $VERSION = '1.27'; # VERSION
14  
15 17 ▶use SOAP::Lite;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 17 ▶use SOAP::Packager;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 # ======================================================================
19  
20 package SOAP::Transport::HTTP::Client;
21  
22 17 ▶use vars qw(@ISA $COMPRESS $USERAGENT_CLASS);
Subroutine BEGIN: called CC=1 SCAR=0.0
23 17 $USERAGENT_CLASS = 'LWP::UserAgent';
24 17 @ISA = qw(SOAP::Client);
25  
26 17 $COMPRESS = 'deflate';
27  
28 17 my ( %redirect, %mpost, %nocompress );
29  
30 # hack for HTTP connection that returns Keep-Alive
31 # miscommunication (?) between LWP::Protocol and LWP::Protocol::http
32 # dies after timeout, but seems like we could make it work
33 17 my $_patched = 0;
34  
35 17 ▶sub patch {
Subroutine patch: called CC=2 SCAR=9.2
36 17 ▶ return if $_patched;
Branch: 1 branch
BranchTrueFalseTotal
if $_patched 2 15 17
37 17 ▶ BEGIN { local ($^W) = 0; }
Subroutine BEGIN: called CC=1 SCAR=0.0
38 {
39 15 local $^W = 0;
40 sub LWP::UserAgent::redirect_ok;
41 1 ▶ *LWP::UserAgent::redirect_ok = sub { 1 }
Subroutine __ANON__: called CC=1 SCAR=0.0
42 15 }
43 {
44  
45 15 package
46 LWP::Protocol;
47 15 local $^W = 0;
48 15 my $collect = \&collect; # store original
49 2 ▶ *collect = sub {
Subroutine __ANON__: called CC=5 SCAR=29.0
50 2 ▶ if ( defined $_[2]->header('Connection')
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[2]->header("Connection") and $_[2]->header("Connection") eq "Keep-Alive") 0 2 2
Condition33%1/3
defined $_[2]->header("Connection") and $_[2]->header("Connection") eq "Keep-Alive"
!ll&&!rl&&r
020
MC/DC0%0/2
defined $_[2]->header("Connection") and $_[2]->header("Connection") eq "Keep-Alive"
defined $_[2]->header("Connection") $_[2]->header("Connection") eq "Keep-Alive"
Truth table33%1/3
A and B
A= defined $_[2]->header("Connection")B= $_[2]->header("Connection") eq "Keep-Alive"
ABresult
0X0
100
111
51 && $_[2]->header('Connection') eq 'Keep-Alive' ) {
52 0 my $data = $_[3]->();
53 my $next =
54 $_[2]->header('Content-Length') &&
55 SOAP::Utils::bytelength($$data) ==
56 $_[2]->header('Content-Length')
57 0 ▶ ? sub { my $str = ''; \$str; }
Subroutine __ANON__: not called CC=1 SCAR=6.9
58 0 ▶ : $_[3];
Branch: 1 branch
BranchTrueFalseTotal
$_[2]->header('Content-Length') && SOAP::Utils::bytelength($$data) == $_[2]->header('Content-Length') ? : 0 0 0
Condition0%0/3
$_[2]->header("Content-Length") and SOAP::Utils::bytelength($$data) == $_[2]->header("Content-Length")
!ll&&!rl&&r
000
MC/DC0%0/2
$_[2]->header("Content-Length") and SOAP::Utils::bytelength($$data) == $_[2]->header("Content-Length")
$_[2]->header("Content-Length") SOAP::Utils::bytelength($$data) == $_[2]->header("Content-Length")
Truth table0%0/3
A and B
A= $_[2]->header("Content-Length")B= SOAP::Utils::bytelength($$data) == $_[2]->header("Content-Length")
ABresult
0X0
100
111
59 0 my $done = 0;
60 0 ▶ $_[3] = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
61 0 ▶ $done++ ? &$next : $data;
Branch: 1 branch
BranchTrueFalseTotal
$done++ ? : 0 0 0
62 0 };
63 }
64 2 goto &$collect;
65 15 };
66 }
67 15 $_patched++;
68 }
69  
70 17 ▶sub DESTROY { SOAP::Trace::objects('()') }
Subroutine DESTROY: called CC=1 SCAR=0.0
71  
72 32 ▶sub http_request {
Subroutine http_request: called CC=2 SCAR=6.9
73 32 my $self = shift;
74 32 ▶ if (@_) { $self->{'_http_request'} = shift; return $self }
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 19 13 32
75 13 return $self->{'_http_request'};
76 }
77  
78 184 ▶sub http_response {
Subroutine http_response: called CC=2 SCAR=6.9
79 184 my $self = shift;
80 184 ▶ if (@_) { $self->{'_http_response'} = shift; return $self }
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 13 171 184
81 171 return $self->{'_http_response'};
82 }
83  
84 18 ▶sub setDebugLogger {
Subroutine setDebugLogger: called CC=1 SCAR=0.0
85 18 my ($self,$logger) = @_;
86 18 $self->{debug_logger} = $logger;
87 }
88  
89 19 ▶sub new {
Subroutine new: called CC=12 SCAR=24.9
90 19 my $class = shift;
91 #print "HTTP.pm DEBUG: in sub new\n";
92  
93 19 ▶ return $class if ref $class; # skip if we're already object...
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 1 18 19
94  
95 18 ▶ if ( !grep { $_ eq $USERAGENT_CLASS } @ISA ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep {$_ eq $SOAP::Transport::HTTP::Client::USERAGENT_CLASS;} @SOAP::Transport::HTTP::Client::ISA) 15 3 18
96 15 push @ISA, $USERAGENT_CLASS;
97 }
98  
99 18 ▶ eval("require $USERAGENT_CLASS")
Branch: 1 branch
BranchTrueFalseTotal
eval "require $SOAP::Transport::HTTP::Client::USERAGENT_CLASS" or die "Could not load UserAgent class $SOAP::Transport::HTTP::Client::USERAGENT_CLASS: $@" 18 0 18
100 or die "Could not load UserAgent class $USERAGENT_CLASS: $@";
101  
102 18 require HTTP::Request;
103 18 require HTTP::Headers;
104  
105 18 ▶ patch() if $SOAP::Constants::PATCH_HTTP_KEEPALIVE;
Branch: 1 branch
BranchTrueFalseTotal
if $SOAP::Constants::PATCH_HTTP_KEEPALIVE 17 1 18
106  
107 18 my ( @params, @methods );
108 18 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 17 18 35
109 17 ▶ $class->can( $_[0] )
Branch: 1 branch
BranchTrueFalseTotal
$class->can($_[0]) ? : 17 0 17
110 ? push( @methods, shift() => shift )
111 : push( @params, shift );
112 }
113 18 my $self = $class->SUPER::new(@params);
114  
115 18 ▶ die
Branch: 1 branch
BranchTrueFalseTotal
unless $self->isa("LWP::UserAgent") 0 18 18
116 "SOAP::Transport::HTTP::Client must inherit from LWP::UserAgent, or one of its subclasses"
117 if !$self->isa("LWP::UserAgent");
118  
119 18 $self->agent( join '/', 'SOAP::Lite', 'Perl',
120 $SOAP::Transport::HTTP::VERSION );
121 18 $self->options( {} );
122  
123 18 $self->http_request( HTTP::Request->new() );
124  
125 18 ▶ while (@methods) {
Branch: 1 branch
BranchTrueFalseTotal
if (@methods) 17 18 35
126 17 my ( $method, $params ) = splice( @methods, 0, 2 );
127 # ssl_opts takes a hash, not a ref - see RT 107924
128 17 ▶ if (ref $params eq 'HASH' && $method eq 'ssl_opts') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $params eq "HASH" and $method eq "ssl_opts") 1 16 17
Condition66%2/3
ref $params eq "HASH" and $method eq "ssl_opts"
!ll&&!rl&&r
1601
MC/DC50%1/2
ref $params eq "HASH" and $method eq "ssl_opts"
ref $params eq "HASH" $method eq "ssl_opts"
Truth table66%2/3
A and B
A= ref $params eq "HASH"B= $method eq "ssl_opts"
ABresult
0X0
100
111
129 1 $self->$method( %$params );
130 1 next;
131 }
132 16 ▶ $self->$method( ref $params eq 'ARRAY' ? @$params : $params );
Branch: 1 branch
BranchTrueFalseTotal
ref $params eq 'ARRAY' ? : 1 15 16
133 }
134  
135 18 SOAP::Trace::objects('()');
136  
137 18 $self->setDebugLogger(\&SOAP::Trace::debug);
138  
139 18 return $self;
140 }
141  
142 12 ▶sub send_receive {
Subroutine send_receive: called CC=43 SCAR=51.8
143 12 my ( $self, %parameters ) = @_;
144 my ( $context, $envelope, $endpoint, $action, $encoding, $parts ) =
145 12 @parameters{qw(context envelope endpoint action encoding parts)};
146  
147 12 ▶ $encoding ||= 'UTF-8';
Condition100%2/2
$encoding ||= "UTF-8"
l!l
111
MC/DC100%1/1
$encoding ||= "UTF-8"
$encoding
Truth table100%2/2
A
A= $encoding
Aresult
11
00
148  
149 12 ▶ $endpoint ||= $self->endpoint;
Condition66%2/3
$endpoint ||= $self->endpoint
l!l&&r!l&&!r
1110
MC/DC0%0/2
$endpoint ||= $self->endpoint
$endpoint $self->endpoint
Truth table66%2/3
A ||= B
A= $endpointB= $self->endpoint
ABresult
1X1
011
000
150  
151 12 my $method = 'POST';
152 12 $COMPRESS = 'gzip';
153  
154 $self->options->{is_compress} ||=
155 exists $self->options->{compress_threshold}
156 0 ▶ && eval { require Compress::Zlib };
Condition33%2/6
$self->options->{"is_compress"} ||= exists $self->options->{"compress_threshold"} && eval { do { require Compress::Zlib } }
l!l&&r!l&&!r
0012
exists $self->options->{'compress_threshold'} && eval { do { require Compress::Zlib } }
!ll&&!rl&&r
1200
MC/DC0%0/3
$self->options->{"is_compress"} ||= exists $self->options->{"compress_threshold"} && eval { do { require Compress::Zlib } }
$self->options->{"is_compress"} exists $self->options->{'compress_threshold'} eval { do { require Compress::Zlib } }
Truth table0%0/4
A ||= B && C
A= $self->options->{"is_compress"}B= exists $self->options->{'compress_threshold'}C= eval { do { require Compress::Zlib } }
ABCresult
1XX1
0111
00X0
0100
157  
158 # Initialize the basic about the HTTP Request object
159 12 my $http_request = $self->http_request()->clone();
160  
161 # $self->http_request(HTTP::Request->new);
162 12 $http_request->headers( HTTP::Headers->new );
163  
164 # TODO - add application/dime
165 12 $http_request->header(
166 Accept => ['text/xml', 'multipart/*', 'application/soap'] );
167 12 $http_request->method($method);
168 12 $http_request->url($endpoint);
169  
170 17 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
171 12 ▶ if ($parts) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parts) 0 12 12
172 0 my $packager = $context->packager;
173 0 $envelope = $packager->package( $envelope, $context );
174 0 for my $hname ( keys %{$packager->headers_http} ) {
175 $http_request->headers->header(
176 0 $hname => $packager->headers_http->{$hname} );
177 }
178  
179 # TODO - DIME support
180 }
181  
182 COMPRESS: {
183 12 my $compressed =
184 !exists $nocompress{$endpoint}
185 && $self->options->{is_compress}
186 12 ▶ && ( $self->options->{compress_threshold} || 0 ) < length $envelope;
Condition25%2/8
!exists $nocompress{$endpoint} && $self->options->{'is_compress'} && ($self->options->{'compress_threshold'} || 0) < length $envelope
!ll&&!rl&&r
1200
not exists $nocompress{$endpoint} and $self->options->{"is_compress"}
!ll&&!rl&&r
0120
$self->options->{'compress_threshold'} || 0
l!l
00
MC/DC0%0/3
!exists $nocompress{$endpoint} && $self->options->{'is_compress'} && ($self->options->{'compress_threshold'} || 0) < length $envelope
not exists $nocompress{$endpoint} $self->options->{"is_compress"} $self->options->{'compress_threshold'}
Truth table25%1/4
not(A) and B && C
A= not exists $nocompress{$endpoint}B= $self->options->{"is_compress"}C= $self->options->{'compress_threshold'}
ABCresult
0XX0
10X0
1100
1111
187  
188  
189 12 my $original_encoding = $http_request->content_encoding;
190  
191 12 while (1) {
192  
193 # check cache for redirect
194 12 ▶ $endpoint = $redirect{$endpoint} if exists $redirect{$endpoint};
Branch: 1 branch
BranchTrueFalseTotal
if exists $redirect{$endpoint} 0 12 12
195  
196 # check cache for M-POST
197 12 ▶ $method = 'M-POST' if exists $mpost{$endpoint};
Branch: 1 branch
BranchTrueFalseTotal
if exists $mpost{$endpoint} 0 12 12
198  
199 # what's this all about?
200 # unfortunately combination of LWP and Perl 5.6.1 and later has bug
201 # in sending multibyte characters. LWP uses length() to calculate
202 # content-length header and starting 5.6.1 length() calculates chars
203 # instead of bytes. 'use bytes' in THIS file doesn't work, because
204 # it's lexically scoped. Unfortunately, content-length we calculate
205 # here doesn't work either, because LWP overwrites it with
206 # content-length it calculates (which is wrong) AND uses length()
207 # during syswrite/sysread, so we are in a bad shape anyway.
208 #
209 # what to do? we calculate proper content-length (using
210 # bytelength() function from SOAP::Utils) and then drop utf8 mark
211 # from string (doing pack with 'C0A*' modifier) if length and
212 # bytelength are not the same
213 12 my $bytelength = SOAP::Utils::bytelength($envelope);
214 12 ▶ if ($] < 5.008) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < 5.008) { } 0 12 12
215 0 $envelope = pack( 'C0A*', $envelope );
216 }
217 else {
218 12 require Encode;
219 12 $envelope = Encode::encode($encoding, $envelope);
220 12 $bytelength = SOAP::Utils::bytelength($envelope);
221 }
222 # if !$SOAP::Constants::DO_NOT_USE_LWP_LENGTH_HACK
223 # && length($envelope) != $bytelength;
224  
225 # compress after encoding
226 # doing it before breaks the compressed content (#74577)
227 12 ▶ $envelope = Compress::Zlib::memGzip($envelope) if $compressed;
Branch: 1 branch
BranchTrueFalseTotal
if $compressed 0 12 12
228  
229 12 $http_request->content($envelope);
230 12 $http_request->protocol('HTTP/1.1');
231  
232 $http_request->proxy_authorization_basic( $ENV{'HTTP_proxy_user'},
233 $ENV{'HTTP_proxy_pass'} )
234 12 ▶ if ( $ENV{'HTTP_proxy_user'} && $ENV{'HTTP_proxy_pass'} );
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"HTTP_proxy_user"} and $ENV{"HTTP_proxy_pass"} 0 12 12
Condition33%1/3
$ENV{"HTTP_proxy_user"} and $ENV{"HTTP_proxy_pass"}
!ll&&!rl&&r
1200
MC/DC0%0/2
$ENV{"HTTP_proxy_user"} and $ENV{"HTTP_proxy_pass"}
$ENV{"HTTP_proxy_user"} $ENV{"HTTP_proxy_pass"}
Truth table33%1/3
A and B
A= $ENV{"HTTP_proxy_user"}B= $ENV{"HTTP_proxy_pass"}
ABresult
0X0
100
111
235  
236 # by Murray Nesbitt
237 12 ▶ if ( $method eq 'M-POST' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($method eq 'M-POST') { } 0 12 12
238 0 my $prefix = sprintf '%04d', int( rand(1000) );
239 0 $http_request->header(
240 Man => qq!"$SOAP::Constants::NS_ENV"; ns=$prefix! );
241 0 ▶ $http_request->header( "$prefix-SOAPAction" => $action )
Branch: 1 branch
BranchTrueFalseTotal
if defined $action 0 0 0
242 if defined $action;
243 }
244 else {
245 12 ▶ $http_request->header( SOAPAction => $action )
Branch: 1 branch
BranchTrueFalseTotal
if defined $action 11 1 12
246 if defined $action;
247 }
248  
249 # $http_request->header(Expect => '100-Continue');
250  
251 # allow compress if present and let server know we could handle it
252 $http_request->header( 'Accept-Encoding' =>
253 [$SOAP::Transport::HTTP::Client::COMPRESS] )
254 12 ▶ if $self->options->{is_compress};
Branch: 1 branch
BranchTrueFalseTotal
if $self->options->{"is_compress"} 0 12 12
255  
256 12 ▶ $http_request->content_encoding(
Branch: 1 branch
BranchTrueFalseTotal
if $compressed 0 12 12
257 $SOAP::Transport::HTTP::Client::COMPRESS)
258 if $compressed;
259  
260 12 ▶ if ( !$http_request->content_type ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $http_request->content_type) { } 12 0 12
elsif (not $SOAP::Constants::DO_NOT_USE_CHARSET and $encoding) { } 0 0 0
261 12 ▶ $http_request->content_type(
Branch: 1 branch
BranchTrueFalseTotal
!$SOAP::Constants::DO_NOT_USE_CHARSET && $encoding ? : 11 1 12
Condition66%2/3
not $SOAP::Constants::DO_NOT_USE_CHARSET and $encoding
!ll&&!rl&&r
1011
MC/DC50%1/2
not $SOAP::Constants::DO_NOT_USE_CHARSET and $encoding
not $SOAP::Constants::DO_NOT_USE_CHARSET $encoding
Truth table66%2/3
not(A) and B
A= not $SOAP::Constants::DO_NOT_USE_CHARSETB= $encoding
ABresult
0X0
100
111
262 join '; ',
263 $SOAP::Constants::DEFAULT_HTTP_CONTENT_TYPE,
264 !$SOAP::Constants::DO_NOT_USE_CHARSET && $encoding
265 ? 'charset=' . lc($encoding)
266 : () );
267 }
268 ▶ elsif ( !$SOAP::Constants::DO_NOT_USE_CHARSET && $encoding ) {
Condition0%0/3
not $SOAP::Constants::DO_NOT_USE_CHARSET and $encoding
!ll&&!rl&&r
000
MC/DC0%0/2
not $SOAP::Constants::DO_NOT_USE_CHARSET and $encoding
not $SOAP::Constants::DO_NOT_USE_CHARSET $encoding
Truth table0%0/3
not(A) and B
A= not $SOAP::Constants::DO_NOT_USE_CHARSETB= $encoding
ABresult
0X0
100
111
269 0 my $tmpType = $http_request->headers->header('Content-type');
270  
271 # $http_request->content_type($tmpType.'; charset=' . lc($encoding));
272 0 my $addition = '; charset=' . lc($encoding);
273 0 ▶ $http_request->content_type( $tmpType . $addition )
Branch: 1 branch
BranchTrueFalseTotal
unless $tmpType =~ /$addition/ 0 0 0
274 if ( $tmpType !~ /$addition/ );
275 }
276  
277 12 ▶ $http_request->content_length($bytelength) unless $compressed;
Branch: 1 branch
BranchTrueFalseTotal
unless $compressed 12 0 12
278 12 SOAP::Trace::transport($http_request);
279 12 &{$self->{debug_logger}}($http_request->as_string);
280  
281 12 ▶ $self->SUPER::env_proxy if $ENV{'HTTP_proxy'};
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"HTTP_proxy"} 0 12 12
282  
283 # send and receive the stuff.
284 # TODO maybe eval this? what happens on connection close?
285 12 $self->http_response( $self->SUPER::request($http_request) );
286 12 SOAP::Trace::transport( $self->http_response );
287 12 &{$self->{debug_logger}}($self->http_response->as_string);
288  
289 # 100 OK, continue to read?
290 12 ▶ if ( (
Branch: 2 branches
BranchTrueFalseTotal
if ($self->http_response->code == 510 || $self->http_response->code == 501 and $method ne 'M-POST') { } 0 12 12
elsif ($self->http_response->code == 415 and $compressed) { } 0 12 12
Condition33%2/6
$self->http_response->code == 510 || $self->http_response->code == 501 and $method ne "M-POST"
!ll&&!rl&&r
1200
$self->http_response->code == 510 or $self->http_response->code == 501
l!l&&r!l&&!r
0012
MC/DC0%0/3
$self->http_response->code == 510 || $self->http_response->code == 501 and $method ne "M-POST"
$self->http_response->code == 510 $self->http_response->code == 501 $method ne "M-POST"
Truth table20%1/5
A or B and C
A= $self->http_response->code == 510B= $self->http_response->code == 501C= $method ne "M-POST"
ABCresult
00X0
1X00
0100
1X11
0111
291 $self->http_response->code == 510
292 || $self->http_response->code == 501
293 )
294 && $method ne 'M-POST'
295 ) {
296 0 $mpost{$endpoint} = 1;
297 }
298 ▶ elsif ( $self->http_response->code == 415 && $compressed ) {
Condition33%1/3
$self->http_response->code == 415 and $compressed
!ll&&!rl&&r
1200
MC/DC0%0/2
$self->http_response->code == 415 and $compressed
$self->http_response->code == 415 $compressed
Truth table33%1/3
A and B
A= $self->http_response->code == 415B= $compressed
ABresult
0X0
100
111
299  
300 # 415 Unsupported Media Type
301 0 $nocompress{$endpoint} = 1;
302 0 $envelope = Compress::Zlib::memGunzip($envelope);
303 0 $http_request->headers->remove_header('Content-Encoding');
304 0 redo COMPRESS; # try again without compression
305 }
306 else {
307 12 last;
308 }
309 }
310 }
311  
312 12 ▶ $redirect{$endpoint} = $self->http_response->request->url
Branch: 1 branch
BranchTrueFalseTotal
if $self->http_response->previous and $self->http_response->previous->is_redirect 1 11 12
Condition66%2/3
$self->http_response->previous and $self->http_response->previous->is_redirect
!ll&&!rl&&r
1101
MC/DC50%1/2
$self->http_response->previous and $self->http_response->previous->is_redirect
$self->http_response->previous $self->http_response->previous->is_redirect
Truth table66%2/3
A and B
A= $self->http_response->previousB= $self->http_response->previous->is_redirect
ABresult
0X0
100
111
313 if $self->http_response->previous
314 && $self->http_response->previous->is_redirect;
315  
316 12 $self->code( $self->http_response->code );
317 12 $self->message( $self->http_response->message );
318 12 $self->is_success( $self->http_response->is_success );
319 12 $self->status( $self->http_response->status_line );
320  
321 # Pull out any cookies from the response headers
322 $self->{'_cookie_jar'}->extract_cookies( $self->http_response )
323 12 ▶ if $self->{'_cookie_jar'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_cookie_jar"} 0 12 12
324  
325 my $content =
326 ( $self->http_response->content_encoding || '' ) =~
327 /\b$SOAP::Transport::HTTP::Client::COMPRESS\b/o
328 && $self->options->{is_compress}
329 12 ▶ ? Compress::Zlib::memGunzip( $self->http_response->content )
Branch: 2 branches
BranchTrueFalseTotal
($self->http_response->content_encoding || '') =~ /\b$SOAP::Transport::HTTP::Client::COMPRESS\b/o && $self->options->{'is_compress'} ? : 0 12 12
($self->http_response->content_encoding || '') =~ /\S/ ? : 0 12 12
Condition42%3/7
($self->http_response->content_encoding || "") =~ /\b$SOAP::Transport::HTTP::Client::COMPRESS\b/o and $self->options->{"is_compress"}
!ll&&!rl&&r
1200
$self->http_response->content_encoding || ''
l!l
012
$self->http_response->content_encoding || ''
l!l
012
MC/DC0%0/2
($self->http_response->content_encoding || "") =~ /\b$SOAP::Transport::HTTP::Client::COMPRESS\b/o and $self->options->{"is_compress"}
$self->http_response->content_encoding $self->options->{"is_compress"}
Truth table33%1/3
A and B
A= $self->http_response->content_encodingB= $self->options->{"is_compress"}
ABresult
0X0
100
111
330 : ( $self->http_response->content_encoding || '' ) =~ /\S/ ? die
331 0 "Can't understand returned Content-Encoding (@{[$self->http_response->content_encoding]})\n"
332 : $self->http_response->content;
333  
334 12 ▶ return $self->http_response->content_type =~ m!^multipart/!i
Branch: 1 branch
BranchTrueFalseTotal
$self->http_response->content_type =~ m[^multipart/]i ? : 0 12 12
335 ? join( "\n", $self->http_response->headers_as_string, $content )
336 : $content;
337 }
338  
339 # ======================================================================
340  
341 package SOAP::Transport::HTTP::Server;
342  
343 17 ▶use vars qw(@ISA $COMPRESS);
Subroutine BEGIN: called CC=1 SCAR=0.0
344 17 @ISA = qw(SOAP::Server);
345  
346 17 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
347  
348 17 $COMPRESS = 'deflate';
349  
350 1 ▶sub DESTROY { SOAP::Trace::objects('()') }
Subroutine DESTROY: called CC=1 SCAR=0.0
351  
352 5 ▶sub setDebugLogger {
Subroutine setDebugLogger: called CC=1 SCAR=0.0
353 5 my ($self,$logger) = @_;
354 5 $self->{debug_logger} = $logger;
355 }
356  
357 23 ▶sub new {
Subroutine new: called CC=2 SCAR=8.1
358 23 require LWP::UserAgent;
359 23 my $self = shift;
360 23 ▶ return $self if ref $self; # we're already an object
Branch: 1 branch
BranchTrueFalseTotal
if ref $self 18 5 23
361  
362 5 my $class = $self;
363 5 $self = $class->SUPER::new(@_);
364 1 ▶ $self->{'_on_action'} = sub {
Subroutine __ANON__: called CC=7 SCAR=29.6
365 1 ▶ ( my $action = shift || '' ) =~ s/^(\"?)(.*)\1$/$2/;
Condition50%1/2
shift() || ''
l!l
01
MC/DC0%0/1
shift() || ''
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
366 1 ▶ die
Branch: 1 branch
BranchTrueFalseTotal
if $action and $action ne join("#", @_) and $action ne join("/", @_) and substr($_[0], -1, 1) ne "/" || $action ne join("", @_) 0 1 1
Condition25%3/12
$action and $action ne join("#", @_) and $action ne join("/", @_) and substr($_[0], -1, 1) ne "/" || $action ne join("", @_)
!ll&&!rl&&r
100
$action and $action ne join("#", @_) and $action ne join("/", @_)
!ll&&!rl&&r
100
$action and $action ne join("#", @_)
!ll&&!rl&&r
100
substr($_[0], -1, 1) ne "/" or $action ne join("", @_)
l!l&&r!l&&!r
000
MC/DC0%0/5
$action and $action ne join("#", @_) and $action ne join("/", @_) and substr($_[0], -1, 1) ne "/" || $action ne join("", @_)
$action $action ne join("#", @_) $action ne join("/", @_) substr($_[0], -1, 1) ne "/" $action ne join("", @_)
Truth table16%1/6
A and B and C and D or E
A= $actionB= $action ne join("#", @_)C= $action ne join("/", @_)D= substr($_[0], -1, 1) ne "/"E= $action ne join("", @_)
ABCDEresult
0XXXX0
10XXX0
110XX0
111000
1111X1
111011
367 0 "SOAPAction shall match 'uri#method' if present (got '$action', expected '@{[join('#', @_)]}'\n"
368 if $action
369 && $action ne join( '#', @_ )
370 && $action ne join( '/', @_ )
371 && ( substr( $_[0], -1, 1 ) ne '/'
372 || $action ne join( '', @_ ) );
373 5 };
374 5 SOAP::Trace::objects('()');
375  
376 5 $self->setDebugLogger(\&SOAP::Trace::debug);
377  
378 5 return $self;
379 }
380  
381 17 ▶sub BEGIN {
Subroutine BEGIN: called CC=2 SCAR=6.9
382 17 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
383 17 for my $method (qw(request response)) {
384 34 my $field = '_' . $method;
385 27 ▶ *$method = sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
386 27 my $self = shift->new;
387 @_
388 ? ( $self->{$field} = shift, return $self )
389 27 ▶ : return $self->{$field};
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 6 21 27
390 34 };
391 }
392 }
393  
394 1 ▶sub handle {
Subroutine handle: called CC=26 SCAR=48.5
395 1 my $self = shift->new;
396  
397 1 &{$self->{debug_logger}}($self->request->content);
398  
399 1 ▶ if ( $self->request->method eq 'POST' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->request->method eq 'POST') { } 1 0 1
elsif ($self->request->method eq 'M-POST') { } 0 0 0
400 1 ▶ $self->action( $self->request->header('SOAPAction') || undef );
Condition50%1/2
$self->request->header('SOAPAction') || undef
l!l
01
MC/DC0%0/1
$self->request->header('SOAPAction') || undef
$self->request->header('SOAPAction')
Truth table50%1/2
A
A= $self->request->header('SOAPAction')
Aresult
11
00
401 }
402 elsif ( $self->request->method eq 'M-POST' ) {
403 0 ▶ return $self->response(
Branch: 1 branch
BranchTrueFalseTotal
unless $self->request->header("Man") =~ /^"$SOAP::Constants::NS_ENV";\s*ns\s*=\s*(\d+)/ 0 0 0
404 HTTP::Response->new(
405 510, # NOT EXTENDED
406 "Expected Mandatory header with $SOAP::Constants::NS_ENV as unique URI"
407 ) )
408 if $self->request->header('Man') !~
409 /^"$SOAP::Constants::NS_ENV";\s*ns\s*=\s*(\d+)/;
410 0 ▶ $self->action( $self->request->header("$1-SOAPAction") || undef );
Condition0%0/2
$self->request->header("$1-SOAPAction") || undef
l!l
00
MC/DC0%0/1
$self->request->header("$1-SOAPAction") || undef
$self->request->header("$1-SOAPAction")
Truth table0%0/2
A
A= $self->request->header("$1-SOAPAction")
Aresult
11
00
411 }
412 else {
413 0 return $self->response(
414 HTTP::Response->new(405) ) # METHOD NOT ALLOWED
415 }
416  
417 1 ▶ my $compressed =
Condition50%1/2
$self->request->content_encoding || ''
l!l
01
MC/DC0%0/1
$self->request->content_encoding || ''
$self->request->content_encoding
Truth table50%1/2
A
A= $self->request->content_encoding
Aresult
11
00
418 ( $self->request->content_encoding || '' ) =~ /\b$COMPRESS\b/;
419 $self->options->{is_compress} ||=
420 0 ▶ $compressed && eval { require Compress::Zlib };
Condition33%2/6
$self->options->{"is_compress"} ||= $compressed && eval { do { require Compress::Zlib } }
l!l&&r!l&&!r
001
$compressed && eval { do { require Compress::Zlib } }
!ll&&!rl&&r
100
MC/DC0%0/3
$self->options->{"is_compress"} ||= $compressed && eval { do { require Compress::Zlib } }
$self->options->{"is_compress"} $compressed eval { do { require Compress::Zlib } }
Truth table0%0/4
A ||= B && C
A= $self->options->{"is_compress"}B= $compressedC= eval { do { require Compress::Zlib } }
ABCresult
1XX1
0111
00X0
0100
421  
422 # signal error if content-encoding is 'deflate', but we don't want it OR
423 # something else, so we don't understand it
424 return $self->response(
425 HTTP::Response->new(415) ) # UNSUPPORTED MEDIA TYPE
426 if $compressed && !$self->options->{is_compress}
427 1 ▶ || !$compressed
Branch: 1 branch
BranchTrueFalseTotal
if $compressed and not $self->options->{"is_compress"} or not $compressed and ($self->request->content_encoding || "") =~ /\S/ 0 1 1
Condition36%4/11
$compressed and not $self->options->{"is_compress"} or not $compressed and ($self->request->content_encoding || "") =~ /\S/
l!l&&r!l&&!r
001
$compressed and not $self->options->{"is_compress"}
!ll&&!rl&&r
100
not $compressed and ($self->request->content_encoding || "") =~ /\S/
!ll&&!rl&&r
010
$self->request->content_encoding || ''
l!l
01
MC/DC0%0/4
$compressed and not $self->options->{"is_compress"} or not $compressed and ($self->request->content_encoding || "") =~ /\S/
$compressed not $self->options->{"is_compress"} not $compressed $self->request->content_encoding
Truth table14%1/7
A and not(B) or not(C) and D
A= $compressedB= not $self->options->{"is_compress"}C= not $compressedD= $self->request->content_encoding
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
428 && ( $self->request->content_encoding || '' ) =~ /\S/;
429  
430 1 ▶ my $content_type = $self->request->content_type || '';
Condition50%1/2
$self->request->content_type || ''
l!l
01
MC/DC0%0/1
$self->request->content_type || ''
$self->request->content_type
Truth table50%1/2
A
A= $self->request->content_type
Aresult
11
00
431  
432 # in some environments (PerlEx?) content_type could be empty, so allow it also
433 # anyway it'll blow up inside ::Server::handle if something wrong with message
434 # TBD: but what to do with MIME encoded messages in THOSE environments?
435 1 ▶ return $self->make_fault( $SOAP::Constants::FAULT_CLIENT,
Branch: 1 branch
BranchTrueFalseTotal
if not $SOAP::Constants::DO_NOT_CHECK_CONTENT_TYPE and $content_type and $content_type ne "application/soap+xml" and $content_type ne "text/xml" and $content_type ne "application/dime" and not $content_type =~ m[^multipart/] 0 1 1
Condition33%5/15
not $SOAP::Constants::DO_NOT_CHECK_CONTENT_TYPE and $content_type and $content_type ne "application/soap+xml" and $content_type ne "text/xml" and $content_type ne "application/dime" and not $content_type =~ m[^multipart/]
!ll&&!rl&&r
100
not $SOAP::Constants::DO_NOT_CHECK_CONTENT_TYPE and $content_type and $content_type ne "application/soap+xml" and $content_type ne "text/xml" and $content_type ne "application/dime"
!ll&&!rl&&r
100
not $SOAP::Constants::DO_NOT_CHECK_CONTENT_TYPE and $content_type and $content_type ne "application/soap+xml" and $content_type ne "text/xml"
!ll&&!rl&&r
100
not $SOAP::Constants::DO_NOT_CHECK_CONTENT_TYPE and $content_type and $content_type ne "application/soap+xml"
!ll&&!rl&&r
100
not $SOAP::Constants::DO_NOT_CHECK_CONTENT_TYPE and $content_type
!ll&&!rl&&r
010
MC/DC0%0/6
not $SOAP::Constants::DO_NOT_CHECK_CONTENT_TYPE and $content_type and $content_type ne "application/soap+xml" and $content_type ne "text/xml" and $content_type ne "application/dime" and not $content_type =~ m[^multipart/]
not $SOAP::Constants::DO_NOT_CHECK_CONTENT_TYPE $content_type $content_type ne "application/soap+xml" $content_type ne "text/xml" $content_type ne "application/dime" not $content_type =~ m[^multipart/]
Truth table14%1/7
not(A) and B and C and D and E and not(F)
A= not $SOAP::Constants::DO_NOT_CHECK_CONTENT_TYPEB= $content_typeC= $content_type ne "application/soap+xml"D= $content_type ne "text/xml"E= $content_type ne "application/dime"F= not $content_type =~ m[^multipart/]
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
11110X0
1111100
1111111
436 "Content-Type must be 'text/xml,' 'multipart/*,' "
437 . "'application/soap+xml,' 'or 'application/dime' instead of '$content_type'"
438 )
439 if !$SOAP::Constants::DO_NOT_CHECK_CONTENT_TYPE
440 && $content_type
441 && $content_type ne 'application/soap+xml'
442 && $content_type ne 'text/xml'
443 && $content_type ne 'application/dime'
444 && $content_type !~ m!^multipart/!;
445  
446 # TODO - Handle the Expect: 100-Continue HTTP/1.1 Header
447 1 ▶ if ( defined( $self->request->header("Expect") )
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->request->header("Expect") and $self->request->header("Expect") eq "100-Continue") 0 1 1
Condition33%1/3
defined $self->request->header("Expect") and $self->request->header("Expect") eq "100-Continue"
!ll&&!rl&&r
100
MC/DC0%0/2
defined $self->request->header("Expect") and $self->request->header("Expect") eq "100-Continue"
defined $self->request->header("Expect") $self->request->header("Expect") eq "100-Continue"
Truth table33%1/3
A and B
A= defined $self->request->header("Expect")B= $self->request->header("Expect") eq "100-Continue"
ABresult
0X0
100
111
448 && ( $self->request->header("Expect") eq "100-Continue" ) ) {
449  
450 }
451  
452 # TODO - this should query SOAP::Packager to see what types it supports,
453 # I don't like how this is hardcoded here.
454 1 ▶ my $content =
Branch: 1 branch
BranchTrueFalseTotal
$compressed ? : 0 1 1
455 $compressed
456 ? Compress::Zlib::uncompress( $self->request->content )
457 : $self->request->content;
458  
459 1 ▶ my $response = $self->SUPER::handle(
Branch: 2 branches
BranchTrueFalseTotal
my $response = $self->SUPER::handle($self->request->content_type =~ m[^multipart/] ? join("\n", $self->request->headers_as_string, $content) : $content) or return 1 0 1
$self->request->content_type =~ m[^multipart/] ? : 0 1 1
460 $self->request->content_type =~ m!^multipart/!
461 ? join( "\n", $self->request->headers_as_string, $content )
462 : $content
463 ) or return;
464  
465 1 &{$self->{debug_logger}}($response);
466  
467 1 $self->make_response( $SOAP::Constants::HTTP_ON_SUCCESS_CODE, $response );
468 }
469  
470 2 ▶sub make_fault {
Subroutine make_fault: called CC=1 SCAR=0.0
471 2 my $self = shift;
472 2 $self->make_response(
473 $SOAP::Constants::HTTP_ON_FAULT_CODE => $self->SUPER::make_fault(@_)
474 );
475 2 return;
476 }
477  
478 3 ▶sub make_response {
Subroutine make_response: called CC=15 SCAR=36.4
479 3 my ( $self, $code, $response ) = @_;
480  
481 3 ▶ my $encoding = $1
Branch: 1 branch
BranchTrueFalseTotal
if $response =~ /^<\?xml(?: version="1.0"| encoding="([^\"]+)")+\?>/ 3 0 3
482 if $response =~ /^<\?xml(?: version="1.0"| encoding="([^\"]+)")+\?>/;
483  
484 3 ▶ $response =~ s!(\?>)!$1<?xml-stylesheet type="text/css"?>!
Branch: 1 branch
BranchTrueFalseTotal
if $self->request->content_type eq "multipart/form-data" 0 3 3
485 if $self->request->content_type eq 'multipart/form-data';
486  
487 $self->options->{is_compress} ||=
488 exists $self->options->{compress_threshold}
489 0 ▶ && eval { require Compress::Zlib };
Condition33%2/6
$self->options->{"is_compress"} ||= exists $self->options->{"compress_threshold"} && eval { do { require Compress::Zlib } }
l!l&&r!l&&!r
003
exists $self->options->{'compress_threshold'} && eval { do { require Compress::Zlib } }
!ll&&!rl&&r
300
MC/DC0%0/3
$self->options->{"is_compress"} ||= exists $self->options->{"compress_threshold"} && eval { do { require Compress::Zlib } }
$self->options->{"is_compress"} exists $self->options->{'compress_threshold'} eval { do { require Compress::Zlib } }
Truth table0%0/4
A ||= B && C
A= $self->options->{"is_compress"}B= exists $self->options->{'compress_threshold'}C= eval { do { require Compress::Zlib } }
ABCresult
1XX1
0111
00X0
0100
490  
491 my $compressed = $self->options->{is_compress}
492 && grep( /\b($COMPRESS|\*)\b/,
493 $self->request->header('Accept-Encoding') )
494 3 ▶ && ( $self->options->{compress_threshold} || 0 ) <
Condition25%2/8
$self->options->{'is_compress'} && grep(/\b($SOAP::Transport::HTTP::Server::COMPRESS|\*)\b/, $self->request->header('Accept-Encoding')) && ($self->options->{'compress_threshold'} || 0) < SOAP::Utils::bytelength($response)
!ll&&!rl&&r
300
$self->options->{"is_compress"} and grep /\b($SOAP::Transport::HTTP::Server::COMPRESS|\*)\b/, $self->request->header("Accept-Encoding")
!ll&&!rl&&r
300
$self->options->{'compress_threshold'} || 0
l!l
00
MC/DC0%0/3
$self->options->{'is_compress'} && grep(/\b($SOAP::Transport::HTTP::Server::COMPRESS|\*)\b/, $self->request->header('Accept-Encoding')) && ($self->options->{'compress_threshold'} || 0) < SOAP::Utils::bytelength($response)
$self->options->{"is_compress"} grep /\b($SOAP::Transport::HTTP::Server::COMPRESS|\*)\b/, $self->request->header("Accept-Encoding") $self->options->{'compress_threshold'}
Truth table25%1/4
A and B && C
A= $self->options->{"is_compress"}B= grep /\b($SOAP::Transport::HTTP::Server::COMPRESS|\*)\b/, $self->request->header("Accept-Encoding")C= $self->options->{'compress_threshold'}
ABCresult
0XX0
10X0
1100
1111
495 SOAP::Utils::bytelength $response;
496  
497 3 ▶ if ($] > 5.007 && $encoding) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] > "5.007" and $encoding) 3 0 3
Condition33%1/3
$] > "5.007" and $encoding
!ll&&!rl&&r
003
MC/DC0%0/2
$] > "5.007" and $encoding
$] > "5.007" $encoding
Truth table33%1/3
A and B
A= $] > "5.007"B= $encoding
ABresult
0X0
100
111
498 3 require Encode;
499 3 $response = Encode::encode( $encoding, $response );
500 }
501  
502 3 ▶ $response = Compress::Zlib::compress($response) if $compressed;
Branch: 1 branch
BranchTrueFalseTotal
if $compressed 0 3 3
503  
504 # this next line does not look like a good test to see if something is multipart
505 # perhaps a /content-type:.*multipart\//gi is a better regex?
506 3 my ($is_multipart) =
507 ( $response =~ /^content-type:.* boundary="([^\"]*)"/im );
508  
509 3 ▶ $self->response(
Branch: 2 branches
BranchTrueFalseTotal
$compressed ? : 0 3 3
!$SOAP::Constants::DO_NOT_USE_CHARSET && $encoding ? : 3 0 3
Condition33%1/3
not $SOAP::Constants::DO_NOT_USE_CHARSET and $encoding
!ll&&!rl&&r
003
MC/DC0%0/2
not $SOAP::Constants::DO_NOT_USE_CHARSET and $encoding
not $SOAP::Constants::DO_NOT_USE_CHARSET $encoding
Truth table33%1/3
not(A) and B
A= not $SOAP::Constants::DO_NOT_USE_CHARSETB= $encoding
ABresult
0X0
100
111
510 HTTP::Response->new(
511 $code => undef,
512 HTTP::Headers->new(
513 'SOAPServer' => $self->product_tokens,
514 $compressed ? ( 'Content-Encoding' => $COMPRESS ) : (),
515 'Content-Type' => join( '; ',
516 'text/xml',
517 !$SOAP::Constants::DO_NOT_USE_CHARSET
518 && $encoding ? 'charset=' . lc($encoding) : () ),
519 'Content-Length' => SOAP::Utils::bytelength $response
520 ),
521 $response,
522 ) );
523  
524 3 ▶ $self->response->headers->header( 'Content-Type' =>
Branch: 1 branch
BranchTrueFalseTotal
if $is_multipart 0 3 3
525 'Multipart/Related; type="text/xml"; start="<main_envelope>"; boundary="'
526 . $is_multipart
527 . '"' )
528 if $is_multipart;
529 }
530  
531 # ->VERSION leaks a scalar every call - no idea why.
532 4 ▶sub product_tokens {
Subroutine product_tokens: called CC=1 SCAR=0.0
533 4 join '/', 'SOAP::Lite', 'Perl', $SOAP::Transport::HTTP::VERSION;
534 }
535  
536 # ======================================================================
537  
538 package SOAP::Transport::HTTP::CGI;
539  
540 17 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
541 17 @ISA = qw(SOAP::Transport::HTTP::Server);
542  
543 2 ▶sub DESTROY { SOAP::Trace::objects('()') }
Subroutine DESTROY: called CC=1 SCAR=0.0
544  
545 62 ▶sub new {
Subroutine new: called CC=3 SCAR=11.2
546 62 my $self = shift;
547 62 ▶ return $self if ref $self;
Branch: 1 branch
BranchTrueFalseTotal
if ref $self 59 3 62
548  
549 3 ▶ my $class = ref($self) || $self;
Condition33%1/3
ref $self || $self
l!l&&r!l&&!r
030
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table33%1/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
550 3 $self = $class->SUPER::new(@_);
551 3 SOAP::Trace::objects('()');
552  
553 3 return $self;
554 }
555  
556 2 ▶sub make_response {
Subroutine make_response: called CC=1 SCAR=0.0
557 2 my $self = shift;
558 2 $self->SUPER::make_response(@_);
559 }
560  
561 1 ▶sub handle {
Subroutine handle: called CC=23 SCAR=46.0
562 1 my $self = shift->new;
563  
564 1 ▶ my $length = $ENV{'CONTENT_LENGTH'} || 0;
Condition50%1/2
$ENV{'CONTENT_LENGTH'} || 0
l!l
10
MC/DC0%0/1
$ENV{'CONTENT_LENGTH'} || 0
$ENV{'CONTENT_LENGTH'}
Truth table50%1/2
A
A= $ENV{'CONTENT_LENGTH'}
Aresult
11
00
565  
566 # if the HTTP_TRANSFER_ENCODING env is defined, set $chunked if it's chunked*
567 # else to false
568 my $chunked = (defined $ENV{'HTTP_TRANSFER_ENCODING'}
569 1 ▶ && $ENV{'HTTP_TRANSFER_ENCODING'} =~ /^chunked.*$/) || 0;
Condition40%2/5
defined $ENV{'HTTP_TRANSFER_ENCODING'} && $ENV{'HTTP_TRANSFER_ENCODING'} =~ /^chunked.*$/ || 0
l!l
01
defined $ENV{"HTTP_TRANSFER_ENCODING"} and $ENV{"HTTP_TRANSFER_ENCODING"} =~ /^chunked.*$/
!ll&&!rl&&r
100
MC/DC0%0/2
defined $ENV{'HTTP_TRANSFER_ENCODING'} && $ENV{'HTTP_TRANSFER_ENCODING'} =~ /^chunked.*$/ || 0
defined $ENV{"HTTP_TRANSFER_ENCODING"} $ENV{"HTTP_TRANSFER_ENCODING"} =~ /^chunked.*$/
Truth table33%1/3
A and B
A= defined $ENV{"HTTP_TRANSFER_ENCODING"}B= $ENV{"HTTP_TRANSFER_ENCODING"} =~ /^chunked.*$/
ABresult
111
0X0
100
570  
571  
572 1 my $content = q{};
573  
574 1 ▶ if ($chunked) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chunked) 0 1 1
575 0 my $buffer;
576 0 binmode(STDIN);
577 0 ▶ while ( read( STDIN, my $buffer, 1024 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (read STDIN, my $buffer, 1024) 0 0 0
578 0 $content .= $buffer;
579 }
580 0 $length = length($content);
581 }
582  
583 1 ▶ if ( !$length ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $length) { } 0 1 1
elsif (defined $SOAP::Constants::MAX_CONTENT_SIZE and $length > $SOAP::Constants::MAX_CONTENT_SIZE) { } 0 1 1
584 0 $self->response( HTTP::Response->new(411) ) # LENGTH REQUIRED
585 }
586 ▶ elsif ( defined $SOAP::Constants::MAX_CONTENT_SIZE
Condition33%1/3
defined $SOAP::Constants::MAX_CONTENT_SIZE and $length > $SOAP::Constants::MAX_CONTENT_SIZE
!ll&&!rl&&r
100
MC/DC0%0/2
defined $SOAP::Constants::MAX_CONTENT_SIZE and $length > $SOAP::Constants::MAX_CONTENT_SIZE
defined $SOAP::Constants::MAX_CONTENT_SIZE $length > $SOAP::Constants::MAX_CONTENT_SIZE
Truth table33%1/3
A and B
A= defined $SOAP::Constants::MAX_CONTENT_SIZEB= $length > $SOAP::Constants::MAX_CONTENT_SIZE
ABresult
0X0
100
111
587 && $length > $SOAP::Constants::MAX_CONTENT_SIZE ) {
588 0 $self->response( HTTP::Response->new(413) ) # REQUEST ENTITY TOO LARGE
589 }
590 else {
591 1 ▶ if ( exists $ENV{EXPECT} && $ENV{EXPECT} =~ /\b100-Continue\b/i ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $ENV{"EXPECT"} and $ENV{"EXPECT"} =~ /\b100-Continue\b/i) 0 1 1
Condition33%1/3
exists $ENV{"EXPECT"} and $ENV{"EXPECT"} =~ /\b100-Continue\b/i
!ll&&!rl&&r
100
MC/DC0%0/2
exists $ENV{"EXPECT"} and $ENV{"EXPECT"} =~ /\b100-Continue\b/i
exists $ENV{"EXPECT"} $ENV{"EXPECT"} =~ /\b100-Continue\b/i
Truth table33%1/3
A and B
A= exists $ENV{"EXPECT"}B= $ENV{"EXPECT"} =~ /\b100-Continue\b/i
ABresult
0X0
100
111
592 0 print "HTTP/1.1 100 Continue\r\n\r\n";
593 }
594  
595 #my $content = q{};
596 1 ▶ if ( !$chunked ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($chunked) 1 0 1
597 1 my $buffer;
598 1 binmode(STDIN);
599 1 ▶ if ( defined $ENV{'MOD_PERL'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ENV{'MOD_PERL'}) { } 0 1 1
600 0 ▶ while ( read( STDIN, $buffer, $length ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (read STDIN, $buffer, $length) 0 0 0
601 0 $content .= $buffer;
602 0 ▶ last if ( length($content) >= $length );
Branch: 1 branch
BranchTrueFalseTotal
if length $content >= $length 0 0 0
603 }
604 } else {
605 1 ▶ while ( sysread( STDIN, $buffer, $length ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (sysread STDIN, $buffer, $length) 1 0 1
606 1 $content .= $buffer;
607 1 ▶ last if ( length($content) >= $length );
Branch: 1 branch
BranchTrueFalseTotal
if length $content >= $length 1 0 1
608 }
609 }
610 }
611  
612 $self->request(
613 HTTP::Request->new(
614 $ENV{'REQUEST_METHOD'} || '' => $ENV{'SCRIPT_NAME'},
615 HTTP::Headers->new(
616 1 ▶ map { (
Condition50%1/2
$ENV{'REQUEST_METHOD'} || ''
l!l
10
MC/DC0%0/1
$ENV{'REQUEST_METHOD'} || ''
$ENV{'REQUEST_METHOD'}
Truth table50%1/2
A
A= $ENV{'REQUEST_METHOD'}
Aresult
11
00
617 /^HTTP_(.+)/i
618 ? ( $1 =~ m/SOAPACTION/ )
619 ? ('SOAPAction')
620 : ($1)
621 : $_
622 36 ▶ ) => $ENV{$_}
Branch: 2 branches
BranchTrueFalseTotal
/^HTTP_(.+)/i ? : 0 36 36
$1 =~ /SOAPACTION/ ? : 0 0 0
623 } keys %ENV
624 ),
625 $content,
626 ) );
627 1 $self->SUPER::handle;
628 }
629  
630 # imitate nph- cgi for IIS (pointed by Murray Nesbitt)
631 my $status =
632 defined( $ENV{'SERVER_SOFTWARE'} )
633 && $ENV{'SERVER_SOFTWARE'} =~ /IIS/
634 1 ▶ ? $ENV{SERVER_PROTOCOL} || 'HTTP/1.0'
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'SERVER_SOFTWARE'} && $ENV{'SERVER_SOFTWARE'} =~ /IIS/ ? : 0 1 1
Condition20%1/5
defined $ENV{"SERVER_SOFTWARE"} and $ENV{"SERVER_SOFTWARE"} =~ /IIS/
!ll&&!rl&&r
100
$ENV{"SERVER_PROTOCOL"} or "HTTP/1.0"
l!l
00
MC/DC0%0/2
defined $ENV{"SERVER_SOFTWARE"} and $ENV{"SERVER_SOFTWARE"} =~ /IIS/
defined $ENV{"SERVER_SOFTWARE"} $ENV{"SERVER_SOFTWARE"} =~ /IIS/
MC/DC0%0/1
$ENV{"SERVER_PROTOCOL"} or "HTTP/1.0"
$ENV{"SERVER_PROTOCOL"}
Truth table33%1/3
A and B
A= defined $ENV{"SERVER_SOFTWARE"}B= $ENV{"SERVER_SOFTWARE"} =~ /IIS/
ABresult
0X0
100
111
Truth table0%0/2
A
A= $ENV{"SERVER_PROTOCOL"}
Aresult
11
00
635 : 'Status:';
636 1 my $code = $self->response->code;
637  
638 1 binmode(STDOUT);
639  
640 1 print STDOUT "$status $code ", HTTP::Status::status_message($code),
641 "\015\012", $self->response->headers_as_string("\015\012"), "\015\012",
642 $self->response->content;
643 }
644  
645 # ======================================================================
646  
647 package SOAP::Transport::HTTP::Daemon;
648  
649 17 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
650 17 ▶use vars qw($AUTOLOAD @ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
651 17 @ISA = qw(SOAP::Transport::HTTP::Server);
652  
653 1 ▶sub DESTROY { SOAP::Trace::objects('()') }
Subroutine DESTROY: called CC=1 SCAR=0.0
654  
655 #sub new { require HTTP::Daemon;
656 17 ▶sub new {
Subroutine new: called CC=11 SCAR=29.8
657 17 my $self = shift;
658 17 ▶ return $self if ( ref $self );
Branch: 1 branch
BranchTrueFalseTotal
if ref $self 16 1 17
659  
660 1 my $class = $self;
661  
662 1 my ( @params, @methods );
663 1 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 1 1
664 0 ▶ $class->can( $_[0] )
Branch: 1 branch
BranchTrueFalseTotal
$class->can($_[0]) ? : 0 0 0
665 ? push( @methods, shift() => shift )
666 : push( @params, shift );
667 }
668 1 $self = $class->SUPER::new;
669  
670 # Added in 0.65 - Thanks to Nils Sowen
671 # use SSL if there is any parameter with SSL_* in the name
672 1 ▶ $self->SSL(1) if !$self->SSL && grep /^SSL_/, @params;
Branch: 1 branch
BranchTrueFalseTotal
if not $self->SSL and grep /^SSL_/, @params 0 1 1
Condition33%1/3
not $self->SSL and grep /^SSL_/, @params
!ll&&!rl&&r
010
MC/DC0%0/2
not $self->SSL and grep /^SSL_/, @params
not $self->SSL grep /^SSL_/, @params
Truth table33%1/3
not(A) and B
A= not $self->SSLB= grep /^SSL_/, @params
ABresult
0X0
100
111
673 1 my $http_daemon = $self->http_daemon_class;
674 1 ▶ eval "require $http_daemon"
Branch: 1 branch
BranchTrueFalseTotal
unless $http_daemon->can("new") 1 0 1
Condition40%2/5
$http_daemon->can('new') || (eval "require $http_daemon" || Carp::croak($@))
l!l&&r!l&&!r
010
eval "require $http_daemon" or Carp::croak($@)
l!l
10
MC/DC0%0/2
$http_daemon->can('new') || (eval "require $http_daemon" || Carp::croak($@))
$http_daemon->can('new') eval "require $http_daemon"
Truth table33%1/3
A || B
A= $http_daemon->can('new')B= eval "require $http_daemon"
ABresult
1X1
011
000
675 or Carp::croak $@
676 unless $http_daemon->can('new');
677  
678 1 ▶ $self->{_daemon} = $http_daemon->new(@params)
Branch: 1 branch
BranchTrueFalseTotal
$self->{"_daemon"} = $http_daemon->new(@params) or Carp::croak("Can't create daemon: $!") 1 0 1
679 or Carp::croak "Can't create daemon: $!";
680  
681 # End SSL patch
682  
683 1 $self->myuri( URI->new( $self->url )->canonical->as_string );
684  
685 1 ▶ while (@methods) {
Branch: 1 branch
BranchTrueFalseTotal
if (@methods) 0 1 1
686 0 my ( $method, $params ) = splice( @methods, 0, 2 );
687 0 ▶ $self->$method(
Branch: 1 branch
BranchTrueFalseTotal
ref $params eq 'ARRAY' ? : 0 0 0
688 ref $params eq 'ARRAY'
689 ? @$params
690 : $params
691 );
692 }
693 1 SOAP::Trace::objects('()');
694  
695 1 return $self;
696 }
697  
698 8 ▶sub SSL {
Subroutine SSL: called CC=2 SCAR=6.9
699 8 my $self = shift->new;
700 8 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 2 6 8
701 2 $self->{_SSL} = shift;
702 2 return $self;
703 }
704 6 return $self->{_SSL};
705 }
706  
707 3 ▶sub http_daemon_class { shift->SSL ? 'HTTP::Daemon::SSL' : 'HTTP::Daemon' }
Subroutine http_daemon_class: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
(shift())->SSL ? : 1 2 3
708  
709 1 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=2 SCAR=7.0
710 1 my $method = substr( $AUTOLOAD, rindex( $AUTOLOAD, '::' ) + 2 );
711 1 ▶ return if $method eq 'DESTROY';
Branch: 1 branch
BranchTrueFalseTotal
if $method eq "DESTROY" 0 1 1
712  
713 17 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
714 1 ▶ *$AUTOLOAD = sub { shift->{_daemon}->$method(@_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
715 1 goto &$AUTOLOAD;
716 }
717  
718 0 ▶sub handle {
Subroutine handle: not called CC=6 SCAR=37.4
719 0 my $self = shift->new;
720 0 ▶ while ( my $c = $self->accept ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $c = $self->accept) 0 0 0
721 0 ▶ while ( my $r = $c->get_request ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $r = $c->get_request) 0 0 0
722 0 $self->request($r);
723 0 $self->SUPER::handle;
724 0 eval {
725 0 ▶ local $SIG{PIPE} = sub {die "SIGPIPE"};
Subroutine __ANON__: not called CC=1 SCAR=6.9
726 0 $c->send_response( $self->response );
727 };
728 0 ▶ if ($@ && $@ !~ /^SIGPIPE/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@ and not $@ =~ /^SIGPIPE/) 0 0 0
Condition0%0/3
$@ and not $@ =~ /^SIGPIPE/
!ll&&!rl&&r
000
MC/DC0%0/2
$@ and not $@ =~ /^SIGPIPE/
$@ not $@ =~ /^SIGPIPE/
Truth table0%0/3
A and not(B)
A= $@B= not $@ =~ /^SIGPIPE/
ABresult
0X0
100
111
729 0 die $@;
730 }
731 }
732  
733 # replaced ->close, thanks to Sean Meisner <Sean.Meisner@VerizonWireless.com>
734 # shutdown() doesn't work on AIX. close() is used in this case. Thanks to Jos Clijmans <jos.clijmans@recyfin.be>
735 0 ▶ $c->can('shutdown')
Branch: 1 branch
BranchTrueFalseTotal
$c->can('shutdown') ? : 0 0 0
736 ? $c->shutdown(2)
737 : $c->close();
738 0 $c->close;
739 }
740 }
741  
742 # ======================================================================
743  
744 package SOAP::Transport::HTTP::Apache;
745  
746 17 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
747 17 @ISA = qw(SOAP::Transport::HTTP::Server);
748  
749 0 ▶sub DESTROY { SOAP::Trace::objects('()') }
Subroutine DESTROY: not called CC=1 SCAR=6.9
750  
751 0 ▶sub new {
Subroutine new: not called CC=8 SCAR=42.8
752 0 my $self = shift;
753 0 ▶ unless ( ref $self ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $self) 0 0 0
754 0 ▶ my $class = ref($self) || $self;
Condition0%0/3
ref $self || $self
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table0%0/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
755 0 $self = $class->SUPER::new(@_);
756 0 SOAP::Trace::objects('()');
757 }
758  
759 # Added this code thanks to JT Justman
760 # This code improves and provides more robust support for
761 # multiple versions of Apache and mod_perl
762  
763 # mod_perl 2.0
764 0 ▶ if ( defined $ENV{MOD_PERL_API_VERSION}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ENV{'MOD_PERL_API_VERSION'} and $ENV{'MOD_PERL_API_VERSION'} >= 2) { } 0 0 0
Condition0%0/3
defined $ENV{"MOD_PERL_API_VERSION"} and $ENV{"MOD_PERL_API_VERSION"} >= 2
!ll&&!rl&&r
000
MC/DC0%0/2
defined $ENV{"MOD_PERL_API_VERSION"} and $ENV{"MOD_PERL_API_VERSION"} >= 2
defined $ENV{"MOD_PERL_API_VERSION"} $ENV{"MOD_PERL_API_VERSION"} >= 2
Truth table0%0/3
A and B
A= defined $ENV{"MOD_PERL_API_VERSION"}B= $ENV{"MOD_PERL_API_VERSION"} >= 2
ABresult
0X0
100
111
765 && $ENV{MOD_PERL_API_VERSION} >= 2 ) {
766 0 require Apache2::RequestRec;
767 0 require Apache2::RequestIO;
768 0 require Apache2::Const;
769 0 require Apache2::RequestUtil;
770 0 require APR::Table;
771 0 Apache2::Const->import( -compile => 'OK' );
772 0 Apache2::Const->import( -compile => 'HTTP_BAD_REQUEST' );
773 0 $self->{'MOD_PERL_VERSION'} = 2;
774 0 $self->{OK} = &Apache2::Const::OK;
775 }
776 else { # mod_perl 1.xx
777 0 ▶ die "Could not find or load mod_perl"
Branch: 1 branch
BranchTrueFalseTotal
unless eval "require mod_perl" 0 0 0
778 unless ( eval "require mod_perl" );
779 0 ▶ die "Could not detect your version of mod_perl"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $mod_perl::VERSION 0 0 0
780 if ( !defined($mod_perl::VERSION) );
781 0 ▶ if ( $mod_perl::VERSION < 1.99 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mod_perl::VERSION < 1.99) { } 0 0 0
782 0 require Apache;
783 0 require Apache::Constants;
784 0 Apache::Constants->import('OK');
785 0 Apache::Constants->import('HTTP_BAD_REQUEST');
786 0 $self->{'MOD_PERL_VERSION'} = 1;
787 0 $self->{OK} = &Apache::Constants::OK;
788 }
789 else {
790 0 require Apache::RequestRec;
791 0 require Apache::RequestIO;
792 0 require Apache::Const;
793 0 Apache::Const->import( -compile => 'OK' );
794 0 Apache::Const->import( -compile => 'HTTP_BAD_REQUEST' );
795 0 $self->{'MOD_PERL_VERSION'} = 1.99;
796 0 $self->{OK} = &Apache::OK;
797 }
798 }
799  
800 0 return $self;
801 }
802  
803 0 ▶sub handler {
Subroutine handler: not called CC=10 SCAR=47.0
804 0 my $self = shift->new;
805 0 my $r = shift;
806  
807 # Begin patch from JT Justman
808 0 ▶ if ( !$r ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($r) 0 0 0
809 0 ▶ if ( $self->{'MOD_PERL_VERSION'} < 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'MOD_PERL_VERSION'} < 2) { } 0 0 0
810 0 $r = Apache->request();
811 }
812 else {
813 0 $r = Apache2::RequestUtil->request();
814 }
815 }
816  
817 0 my $cont_len;
818 0 ▶ if ( $self->{'MOD_PERL_VERSION'} < 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'MOD_PERL_VERSION'} < 2) { } 0 0 0
819 0 $cont_len = $r->header_in('Content-length');
820 }
821 else {
822 0 $cont_len = $r->headers_in->get('Content-length');
823 }
824  
825 # End patch from JT Justman
826  
827 0 my $content = "";
828 0 ▶ if ( $cont_len > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cont_len > 0) { } 0 0 0
829 0 my $buf;
830  
831 # attempt to slurp in the content at once...
832 0 ▶ $content .= $buf while ( $r->read( $buf, $cont_len ) > 0 );
Branch: 1 branch
BranchTrueFalseTotal
$r->read($buf, $cont_len) > 0 and do { $content .= $buf } 0 0 0
833 }
834 else {
835  
836 # throw appropriate error for mod_perl 2
837 return Apache2::Const::HTTP_BAD_REQUEST()
838 0 ▶ if ( $self->{'MOD_PERL_VERSION'} >= 2 );
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"MOD_PERL_VERSION"} >= 2 0 0 0
839 0 return Apache::Constants::BAD_REQUEST();
840 }
841  
842 0 my %headers;
843 0 ▶ if ( $self->{'MOD_PERL_VERSION'} < 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'MOD_PERL_VERSION'} < 2) { } 0 0 0
844 0 %headers = $r->headers_in; # Apache::Table structure
845 } else {
846 0 %headers = %{ $r->headers_in }; # Apache2::RequestRec structure
847 }
848  
849 0 $self->request(
850 HTTP::Request->new(
851 $r->method() => $r->uri,
852 HTTP::Headers->new( %headers ),
853 $content
854 ) );
855 0 $self->SUPER::handle;
856  
857 # we will specify status manually for Apache, because
858 # if we do it as it has to be done, returning SERVER_ERROR,
859 # Apache will modify our content_type to 'text/html; ....'
860 # which is not what we want.
861 # will emulate normal response, but with custom status code
862 # which could also be 500.
863 0 ▶ if ($self->{'MOD_PERL_VERSION'} < 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'MOD_PERL_VERSION'} < 2) { } 0 0 0
864 0 $r->status( $self->response->code );
865 }
866 else {
867 0 $r->status_line($self->response->code);
868 }
869  
870 # Begin JT Justman patch
871 0 ▶ if ( $self->{'MOD_PERL_VERSION'} > 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'MOD_PERL_VERSION'} > 1) { } 0 0 0
872 0 ▶ $self->response->headers->scan(sub { $r->headers_out->add(@_) });
Subroutine __ANON__: not called CC=1 SCAR=6.9
873 0 $r->content_type( join '; ', $self->response->content_type );
874 }
875 else {
876 0 ▶ $self->response->headers->scan( sub { $r->header_out(@_) } );
Subroutine __ANON__: not called CC=1 SCAR=6.9
877 0 $r->send_http_header( join '; ', $self->response->content_type );
878 }
879  
880 0 $r->print( $self->response->content );
881 0 return $self->{OK};
882  
883 # End JT Justman patch
884 }
885  
886 0 ▶sub configure {
Subroutine configure: not called CC=5 SCAR=34.0
887 0 my $self = shift->new;
888 0 my $config = shift->dir_config;
889 0 for (%$config) {
890 $config->{$_} =~ /=>/
891 ? $self->$_( {split /\s*(?:=>|,)\s*/, $config->{$_}} )
892 : ref $self->$_() ? () # hm, nothing can be done here
893 0 ▶ : $self->$_( split /\s+|\s*,\s*/, $config->{$_} )
Branch: 3 branches
BranchTrueFalseTotal
if $self->can($_) 0 0 0
$config->{$_} =~ /=>/ ? : 0 0 0
ref $self->$_ ? : 0 0 0
894 if $self->can($_);
895 }
896 0 return $self;
897 }
898  
899 {
900  
901 # just create alias
902 17 sub handle;
903 17 *handle = \&handler
904 }
905  
906 # ======================================================================
907 #
908 # Copyright (C) 2001 Single Source oy (marko.asplund@kronodoc.fi)
909 # a FastCGI transport class for SOAP::Lite.
910 # Updated formatting and removed dead code in new() in 2008
911 # by Martin Kutter
912 #
913 # ======================================================================
914  
915 package SOAP::Transport::HTTP::FCGI;
916  
917 17 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
918 17 @ISA = qw(SOAP::Transport::HTTP::CGI);
919  
920 1 ▶sub DESTROY { SOAP::Trace::objects('()') }
Subroutine DESTROY: called CC=1 SCAR=0.0
921  
922 7 ▶sub new {
Subroutine new: called CC=2 SCAR=6.9
923  
924 7 require FCGI;
925 7 Exporter::require_version( 'FCGI' => 0.47 )
926 ; # requires thread-safe interface
927  
928 7 my $class = shift;
929 7 ▶ return $class if ref $class;
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 6 1 7
930  
931 1 my $self = $class->SUPER::new(@_);
932 1 $self->{_fcgirq} = FCGI::Request( \*STDIN, \*STDOUT, \*STDERR );
933 1 SOAP::Trace::objects('()');
934  
935 1 return $self;
936 }
937  
938 0 ▶sub handle {
Subroutine handle: not called CC=2 SCAR=17.9
939 0 my $self = shift->new;
940  
941 0 my ( $r1, $r2 );
942 0 my $fcgirq = $self->{_fcgirq};
943  
944 0 ▶ while ( ( $r1 = $fcgirq->Accept() ) >= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (($r1 = $fcgirq->Accept) >= 0) 0 0 0
945 0 $r2 = $self->SUPER::handle;
946 }
947  
948 0 return undef;
949 }
950  
951 # ======================================================================
952  
953 17 1;
« lib/SOAP/Test.pm ↑ Summary lib/SOAP/Transport/POP3.pm »