blib/lib/SOAP/MIME.pm

filter: Statementstmt 3.6% 8 / 221 Branchbran 0.0% 0 / 168 Conditioncond 0.0% 0 / 124 MC/DCmcdc 0.0% 0 / 66 Subroutinesub 14.2% 2 / 14 Podpod 100% 2 / 2 totaltotal 2.0% 12 / 595 CC 135 SCAR 65.7
CC
135
Cov
2%
send_receive
1406.0
call
812.0
handle
650.0
CRAP 716.3
↑ Summary
1 # SOAP::MIME Perl Module
2 # This is a patch of sorts to SOAP::Lite <http://soaplite.com/>
3 #
4 # Author: Byrne Reese <byrne@majordojo.com>
5 #
6 # TO DO:
7 # * SOAP::Lite is incredibly inefficient in its use of memory. It passed
8 # most objects around by value, which inadvertently create copies of
9 # everything. SOAP::Lite needs to pass around references, especially
10 # when passing around things as potentially big as attachments.
11 package SOAP::MIME;
12  
13 1 $VERSION=0.55;
14  
15 BEGIN {
16  
17 # This is being added by Byrne to support attachments. I need to add
18 # an array property to the SOAP::SOM object as a placeholder for
19 # decoded attachments. I add this getter/setting for attachments, and
20 # I will then call this in SOAP::Deserializer to populate the SOM object
21 # with the decoded attachments (MIME::Entity's)
22  
23 # This exposes any MIME::Entities that were parsed out of a MIME formatted
24 # response.
25 0 ▶ sub SOAP::SOM::parts {
Subroutine parts: not called CC=2 SCAR=17.9
26 0 my $self = shift;
27 0 ▶ @_ ? ($self->{_parts} = shift, return $self) : return $self->{_parts};
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
28 }
29  
30 0 ▶ sub SOAP::Deserializer::deserialize {
Subroutine deserialize: not called CC=3 SCAR=24.8
31 0 SOAP::Trace::trace('()');
32 0 my $self = shift->new;
33  
34 # initialize
35 0 $self->hrefs({});
36 0 $self->ids({});
37  
38 # TBD: find better way to signal parsing errors
39 # This is returning a parsed body, however, if the message was mime
40 # formatted, then the self->ids hash should be populated with mime parts
41  
42 # I think I am going to chunk this - and have the decode subroutine
43 # parse the MIME::Entity objects into SOAP::SOM parts.
44 0 my $parsed = $self->decode($_[0]); # TBD: die on possible errors in Parser?
45  
46 0 $self->decode_object($parsed);
47 0 my $som = SOAP::SOM->new($parsed);
48  
49 # TODO
50 # okay - here is a problem: on the server side it does not look like the
51 # parts are properly parsed out, but it works client side
52 # Latest - higher up the execution stack this is cool - parts are found. I
53 # can even print them out. But when I get here, either a) I don't access them
54 # properly, or b) they have been lost somehow.
55 0 ▶ if ($self->mimeparser->{'_parts'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->mimeparser->{"_parts"}) 0 0 0
56 0 $som->{'_parts'} = $self->mimeparser->{'_parts'};
57 }
58  
59 # if there are some IDs (from mime processing), then process others
60 # otherwise delay till we first meet IDs
61 0 ▶ if (keys %{$self->ids()}) {
Branch: 1 branch
BranchTrueFalseTotal
if (keys %{$self->ids;}) { } 0 0 0
62 0 $self->traverse_ids($parsed);
63 } else {
64 0 $self->ids($parsed);
65 }
66 0 return $som;
67 }
68  
69 0 ▶ sub SOAP::MIMEParser::DESTROY {
Subroutine DESTROY: not called CC=1 SCAR=6.9
70 0 my $self = shift;
71 0 $self->{_parts} = undef;
72 }
73  
74 0 ▶ sub SOAP::MIMEParser::get_multipart_id { (shift || '') =~ /^<?(.+)>?$/; $1 || '' }
Subroutine get_multipart_id: not called CC=3 SCAR=24.8
Branch: 1 branch
BranchTrueFalseTotal
$1 or "" 0 0 0
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
75  
76 sub SOAP::MIMEParser::generate_random_string
77 0 ▶ {
Subroutine generate_random_string: not called CC=2 SCAR=17.9
78 0 my ($self,$len) = @_;
79 0 my @chars=('a'..'z','A'..'Z','0'..'9','_');
80 0 my $random_string;
81 0 foreach (1..$len) {
82 0 $random_string .= $chars[rand @chars];
83 }
84 0 return $random_string;
85 }
86  
87 0 ▶ sub SOAP::MIMEParser::decode {
Subroutine decode: not called CC=10 SCAR=47.0
88 0 my $self = shift;
89 0 ▶ my $entity = eval { $self->parse_data(shift) }
Branch: 1 branch
BranchTrueFalseTotal
my $entity = eval { do { $self->parse_data(shift()) } } or die "Something wrong with MIME message: @{[$@ || $self->last_error];}\n" 0 0 0
90 0 ▶ or die "Something wrong with MIME message: @{[$@ || $self->last_error]}\n";
Condition0%0/3
$@ || $self->last_error
l!l&&r!l&&!r
000
MC/DC0%0/2
$@ || $self->last_error
$@ $self->last_error
Truth table0%0/3
A || B
A= $@B= $self->last_error
ABresult
1X1
011
000
91 # I changed this to better populate the array with references
92 # to the MIME::Entity to prevent memory bloat
93 0 ▶ for (my $i=1;$i<=$entity->parts;$i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $entity->parts) 0 0 0
94 0 ▶ push(@{$self->{_parts}},\$entity->parts($i))
Branch: 1 branch
BranchTrueFalseTotal
if ref $entity->parts($i) eq "MIME::Entity" 0 0 0
95 if ref($entity->parts($i)) eq "MIME::Entity";
96 }
97 0 my @result = ();
98 0 ▶ if ($entity->head->mime_type eq 'multipart/form-data') {
Branch: 3 branches
BranchTrueFalseTotal
if ($entity->head->mime_type eq 'multipart/form-data') { } 0 0 0
elsif ($entity->head->mime_type eq 'multipart/related') { } 0 0 0
elsif ($entity->head->mime_type eq 'text/xml') { } 0 0 0
99 0 @result = $self->decode_form_data($entity);
100 } elsif ($entity->head->mime_type eq 'multipart/related') {
101 0 @result = $self->decode_related($entity);
102 } elsif ($entity->head->mime_type eq 'text/xml') {
103 0 @result = ();
104 } else {
105 0 die "Can't handle MIME messsage with specified type (@{[$entity->head->mime_type]})\n";
106 }
107 0 ▶ @result ? @result
Branch: 2 branches
BranchTrueFalseTotal
@result ? : 0 0 0
$entity->bodyhandle->as_string ? : 0 0 0
108 : $entity->bodyhandle->as_string ? [undef, '', undef, $entity->bodyhandle->as_string]
109 : die "No content in MIME message\n";
110 }
111  
112 0 ▶ sub SOAP::MIMEParser::decode_related {
Subroutine decode_related: not called CC=10 SCAR=47.0
113 0 my($self, $entity) = @_;
114 0 my $start = SOAP::MIMEParser::get_multipart_id($entity->head->mime_attr('content-type.start'));
115 0 ▶ my $location = $entity->head->mime_attr('content-location') || 'thismessage:/';
Condition0%0/2
$entity->head->mime_attr('content-location') || 'thismessage:/'
l!l
00
MC/DC0%0/1
$entity->head->mime_attr('content-location') || 'thismessage:/'
$entity->head->mime_attr('content-location')
Truth table0%0/2
A
A= $entity->head->mime_attr('content-location')
Aresult
11
00
116 0 my @result;
117 0 foreach my $part ($entity->parts) {
118 # SOAP::MIME comments:
119 # Weird, the following use of head->get(SCALER[,INDEX]) doesn't work as
120 # expected. Work around is to eliminate the INDEX.
121 # my $pid = get_multipart_id($part->head->mime_attr('content-id',0));
122 # my $plocation = $part->head->get('content-location',0) || '';
123 # my $type = $part->head->mime_type || '';
124 0 my $pid = SOAP::MIMEParser::get_multipart_id($part->head->mime_attr('content-id'));
125 # If Content-ID is not supplied, then generate a random one (HACK - because
126 # MIME::Entity does not do this as it should... content-id is required according
127 # to MIME specification)
128 0 ▶ $pid = $self->generate_random_string(10) if $pid eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $pid eq "" 0 0 0
129 0 my $type = $part->head->mime_type;
130 # If a Content-Location header cannot be found, this will look for an
131 # alternative in the following MIME Header attributes
132 0 ▶ my $plocation = $part->head->get('content-location') ||
Condition0%0/6
$part->head->get('content-location') || $part->head->mime_attr('Content-Disposition.filename') || $part->head->mime_attr('Content-Type.name')
l!l&&r!l&&!r
000
$part->head->get("content-location") or $part->head->mime_attr("Content-Disposition.filename")
l!l&&r!l&&!r
000
MC/DC0%0/3
$part->head->get('content-location') || $part->head->mime_attr('Content-Disposition.filename') || $part->head->mime_attr('Content-Type.name')
$part->head->get("content-location") $part->head->mime_attr("Content-Disposition.filename") $part->head->mime_attr('Content-Type.name')
Truth table0%0/4
A or B || C
A= $part->head->get("content-location")B= $part->head->mime_attr("Content-Disposition.filename")C= $part->head->mime_attr('Content-Type.name')
ABCresult
1XX1
01X1
0011
0000
133 $part->head->mime_attr('Content-Disposition.filename') ||
134 $part->head->mime_attr('Content-Type.name');
135 0 ▶ if ($start && $pid eq $start) {
Branch: 1 branch
BranchTrueFalseTotal
if ($start and $pid eq $start) { } 0 0 0
Condition0%0/3
$start and $pid eq $start
!ll&&!rl&&r
000
MC/DC0%0/2
$start and $pid eq $start
$start $pid eq $start
Truth table0%0/3
A and B
A= $startB= $pid eq $start
ABresult
0X0
100
111
136 0 unshift(@result, [$start, $location, $type, $part->bodyhandle->as_string]);
137 } else {
138 0 push(@result, [$pid, $plocation, $type, $part->bodyhandle->as_string]);
139 }
140 }
141 0 ▶ die "Can't find 'start' parameter in multipart MIME message\n"
Branch: 1 branch
BranchTrueFalseTotal
if @result > 1 and not $start 0 0 0
Condition0%0/3
@result > 1 and not $start
!ll&&!rl&&r
000
MC/DC0%0/2
@result > 1 and not $start
@result > 1 not $start
Truth table0%0/3
A and not(B)
A= @result > 1B= not $start
ABresult
0X0
100
111
142 if @result > 1 && !$start;
143 0 @result;
144 }
145  
146 # This exposes an accessor for setting and getting the MIME::Entities
147 # that will be attached to the SOAP Envelope.
148 0 ▶ sub SOAP::Lite::parts {
Subroutine parts: not called CC=2 SCAR=17.9
Pod documented
149 0 my $self = shift;
150 0 ▶ @_ ? ($self->{_parts} = \@_, return $self) : return $self->{_parts};
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
151 }
152  
153 # This overrides the SOAP::Lite call subroutine used internally by
154 # SOAP::Lite to marshall the request and make a call to the SOAP::Transport
155 # module.
156 0 ▶ sub SOAP::Lite::call {
Subroutine call: not called CC=28 SCAR=67.0
Pod documented
157 0 my $self = shift;
158  
159 0 ▶ return $self->{_call} unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
160  
161 0 my $serializer = $self->serializer;
162  
163 0 ▶ die "Transport is not specified (using proxy() method or service description)\n"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->proxy and UNIVERSAL::isa($self->proxy, "SOAP::Client") 0 0 0
Condition0%0/3
defined $self->proxy and UNIVERSAL::isa($self->proxy, "SOAP::Client")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->proxy and UNIVERSAL::isa($self->proxy, "SOAP::Client")
defined $self->proxy UNIVERSAL::isa($self->proxy, "SOAP::Client")
Truth table0%0/3
A and B
A= defined $self->proxyB= UNIVERSAL::isa($self->proxy, "SOAP::Client")
ABresult
0X0
100
111
164 unless defined $self->proxy && UNIVERSAL::isa($self->proxy => 'SOAP::Client');
165  
166 0 my $top;
167 0 my $headers=new HTTP::Headers();
168 0 ▶ if ($self->parts) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->parts) 0 0 0
169 0 $top = MIME::Entity->build(
170 'Type' => "Multipart/Related"
171 );
172  
173 0 my @args = @_;
174 0 $top->attach(
175 'Type' => 'text/xml',
176 'Content-Transfer-Encoding' => '8bit',
177 'Content-Location' => '/main_envelope',
178 'Content-ID' => '<main_envelope>',
179 'Data' => $serializer->envelope(method => shift(@args), @args),
180 );
181  
182 0 foreach $a (@{$self->parts}) {
183 0 $top->add_part($a);
184 }
185  
186 0 my ($boundary) = $top->head->multipart_boundary;
187 0 $headers->header('Content-Type' => 'Multipart/Related; type="text/xml"; start="<main_envelope>"; boundary="'.$boundary.'"');
188 }
189  
190 0 $serializer->on_nonserialized($self->on_nonserialized);
191 0 ▶ my $response = $self->transport->send_receive(
Branch: 1 branch
BranchTrueFalseTotal
$self->parts ? : 0 0 0
192 endpoint => $self->endpoint,
193 action => scalar($self->on_action->($serializer->uriformethod($_[0]))),
194 # leave only parameters so we can later update them if required
195 envelope => ($self->parts() ? $top->stringify_body : $serializer->envelope(method => shift, @_)),
196 encoding => $serializer->encoding,
197 headers => $headers,
198 );
199  
200 0 $self->parts(undef); # I need to reset this.
201  
202 0 ▶ return $response if $self->outputxml;
Branch: 1 branch
BranchTrueFalseTotal
if $self->outputxml 0 0 0
203  
204 # deserialize and store result
205 0 ▶ my $result = $self->{_call} = eval { $self->deserializer->deserialize($response) } if $response;
Branch: 1 branch
BranchTrueFalseTotal
if $response 0 0 0
206  
207 0 ▶ if (!$self->transport->is_success || # transport fault
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->transport->is_success or $@ or UNIVERSAL::isa($result, "SOAP::SOM") and $result->fault) 0 0 0
Condition0%0/9
not $self->transport->is_success or $@ or UNIVERSAL::isa($result, "SOAP::SOM") and $result->fault
l!l&&r!l&&!r
000
not $self->transport->is_success or $@
l!l&&r!l&&!r
000
UNIVERSAL::isa($result, "SOAP::SOM") and $result->fault
!ll&&!rl&&r
000
MC/DC0%0/4
not $self->transport->is_success or $@ or UNIVERSAL::isa($result, "SOAP::SOM") and $result->fault
not $self->transport->is_success $@ UNIVERSAL::isa($result, "SOAP::SOM") $result->fault
Truth table0%0/5
not(A) or B or C and D
A= not $self->transport->is_successB= $@C= UNIVERSAL::isa($result, "SOAP::SOM")D= $result->fault
ABCDresult
1XXX1
01XX1
00111
000X0
00100
208 $@ || # not deserializible
209 # fault message even if transport OK
210 # or no transport error (for example, fo TCP, POP3, IO implementations)
211 UNIVERSAL::isa($result => 'SOAP::SOM') && $result->fault) {
212 0 ▶ return $self->{_call} = ($self->on_fault->($self, $@ ? $@ . ($response || '') : $result) || $result);
Branch: 1 branch
BranchTrueFalseTotal
$@ ? : 0 0 0
Condition0%0/5
$self->on_fault->($self, $@ ? $@ . ($response || '') : $result) || $result
l!l&&r!l&&!r
000
$response || ''
l!l
00
MC/DC0%0/2
$self->on_fault->($self, $@ ? $@ . ($response || '') : $result) || $result
$self->on_fault->($self, $@ ? $@ . ($response || '') : $result) $result
MC/DC0%0/1
$response || ''
$response
Truth table0%0/3
A || B
A= $self->on_fault->($self, $@ ? $@ . ($response || '') : $result)B= $result
ABresult
1X1
011
000
Truth table0%0/2
A
A= $response
Aresult
11
00
213 }
214  
215 0 ▶ return unless $response; # nothing to do for one-ways
Branch: 1 branch
BranchTrueFalseTotal
unless $response 0 0 0
216  
217 # little bit tricky part that binds in/out parameters
218 0 ▶ if (UNIVERSAL::isa($result => 'SOAP::SOM') &&
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::isa($result, "SOAP::SOM") and $result->paramsout || $result->headers and $serializer->signature) 0 0 0
Condition0%0/9
UNIVERSAL::isa($result, "SOAP::SOM") and $result->paramsout || $result->headers and $serializer->signature
!ll&&!rl&&r
000
UNIVERSAL::isa($result, "SOAP::SOM") and $result->paramsout || $result->headers
!ll&&!rl&&r
000
$result->paramsout or $result->headers
l!l&&r!l&&!r
000
MC/DC0%0/4
UNIVERSAL::isa($result, "SOAP::SOM") and $result->paramsout || $result->headers and $serializer->signature
UNIVERSAL::isa($result, "SOAP::SOM") $result->paramsout $result->headers $serializer->signature
Truth table0%0/6
A and B or C and D
A= UNIVERSAL::isa($result, "SOAP::SOM")B= $result->paramsoutC= $result->headersD= $serializer->signature
ABCDresult
0XXX0
100X0
11X00
10100
11X11
10111
219 ($result->paramsout || $result->headers) &&
220 $serializer->signature) {
221 0 my $num = 0;
222 0 my %signatures = map {$_ => $num++} @{$serializer->signature};
223 0 for ($result->dataof(SOAP::SOM::paramsout), $result->dataof(SOAP::SOM::headers)) {
224 0 ▶ my $signature = join $;, $_->name, $_->type || '';
Condition0%0/2
$_->type || ''
l!l
00
MC/DC0%0/1
$_->type || ''
$_->type
Truth table0%0/2
A
A= $_->type
Aresult
11
00
225 0 ▶ if (exists $signatures{$signature}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $signatures{$signature}) 0 0 0
226 0 my $param = $signatures{$signature};
227 0 my($value) = $_->value; # take first value
228 UNIVERSAL::isa($_[$param] => 'SOAP::Data') ? $_[$param]->SOAP::Data::value($value) :
229 0 ▶ UNIVERSAL::isa($_[$param] => 'ARRAY') ? (@{$_[$param]} = @$value) :
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::isa($_[$param], 'HASH') ? : 0 0 0
230 0 ▶ UNIVERSAL::isa($_[$param] => 'HASH') ? (%{$_[$param]} = %$value) :
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::isa($_[$param], 'SCALAR') ? : 0 0 0
231 0 ▶ UNIVERSAL::isa($_[$param] => 'SCALAR') ? (${$_[$param]} = $$value) :
Branch: 2 branches
BranchTrueFalseTotal
UNIVERSAL::isa($_[$param], 'SOAP::Data') ? : 0 0 0
UNIVERSAL::isa($_[$param], 'ARRAY') ? : 0 0 0
232 ($_[$param] = $value)
233 }
234 }
235 }
236 0 return $result;
237 } # end of call()
238  
239  
240 #
241 # Added to add server-side attachment support
242 # TO DO: in composing the response, I need to parse MIME::Entities that are returned...
243 # breese - 3/17/2003
244 0 ▶ sub SOAP::Server::handle {
Subroutine handle: not called CC=25 SCAR=64.8
245  
246 0 SOAP::Trace::trace('()');
247 0 my $self = shift;
248  
249 # we want to restore it when we are done
250 0 local $SOAP::Constants::DEFAULT_XML_SCHEMA = $SOAP::Constants::DEFAULT_XML_SCHEMA;
251  
252 # SOAP version WILL NOT be restored when we are done.
253 # is it problem?
254  
255 0 my $result = eval {
256 0 local $SIG{__DIE__};
257 0 $self->serializer->soapversion(1.1);
258 0 my $request = eval { $self->deserializer->deserialize($_[0]) };
259 0 ▶ die SOAP::Fault
Branch: 1 branch
BranchTrueFalseTotal
if $@ and $@ =~ /^$SOAP::Constants::WRONG_VERSION/ 0 0 0
Condition0%0/3
$@ and $@ =~ /^$SOAP::Constants::WRONG_VERSION/
!ll&&!rl&&r
000
MC/DC0%0/2
$@ and $@ =~ /^$SOAP::Constants::WRONG_VERSION/
$@ $@ =~ /^$SOAP::Constants::WRONG_VERSION/
Truth table0%0/3
A and B
A= $@B= $@ =~ /^$SOAP::Constants::WRONG_VERSION/
ABresult
0X0
100
111
260 ->faultcode($SOAP::Constants::FAULT_VERSION_MISMATCH)
261 ->faultstring($@)
262 if $@ && $@ =~ /^$SOAP::Constants::WRONG_VERSION/;
263 0 ▶ die "Application failed during request deserialization: $@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
264 0 my $som = ref $request;
265 0 ▶ die "Can't find root element in the message" unless $request->match($som->envelope);
Branch: 1 branch
BranchTrueFalseTotal
unless $request->match($som->envelope) 0 0 0
266 0 $self->serializer->soapversion(SOAP::Lite->soapversion);
267 0 ▶ $self->serializer->xmlschema($SOAP::Constants::DEFAULT_XML_SCHEMA
Branch: 1 branch
BranchTrueFalseTotal
if $self->deserializer->xmlschema 0 0 0
268 = $self->deserializer->xmlschema)
269 if $self->deserializer->xmlschema;
270  
271 die SOAP::Fault
272 ->faultcode($SOAP::Constants::FAULT_MUST_UNDERSTAND)
273 ->faultstring("Unrecognized header has mustUnderstand attribute set to 'true'")
274 if !$SOAP::Constants::DO_NOT_CHECK_MUSTUNDERSTAND &&
275 0 ▶ grep { $_->mustUnderstand &&
Branch: 1 branch
BranchTrueFalseTotal
if not $SOAP::Constants::DO_NOT_CHECK_MUSTUNDERSTAND and grep {$_->mustUnderstand and !$_->actor || $_->actor eq $SOAP::Constants::NEXT_ACTOR;} $request->dataof($som->headers) 0 0 0
Condition0%0/9
not $SOAP::Constants::DO_NOT_CHECK_MUSTUNDERSTAND and grep {$_->mustUnderstand and !$_->actor || $_->actor eq $SOAP::Constants::NEXT_ACTOR;} $request->dataof($som->headers)
!ll&&!rl&&r
000
$_->mustUnderstand && (!$_->actor || $_->actor eq $SOAP::Constants::NEXT_ACTOR)
!ll&&!rl&&r
000
not $_->actor or $_->actor eq $SOAP::Constants::NEXT_ACTOR
l!l&&r!l&&!r
000
MC/DC0%0/2
not $SOAP::Constants::DO_NOT_CHECK_MUSTUNDERSTAND and grep {$_->mustUnderstand and !$_->actor || $_->actor eq $SOAP::Constants::NEXT_ACTOR;} $request->dataof($som->headers)
not $SOAP::Constants::DO_NOT_CHECK_MUSTUNDERSTAND grep {$_->mustUnderstand and !$_->actor || $_->actor eq $SOAP::Constants::NEXT_ACTOR;} $request->dataof($som->headers)
MC/DC0%0/3
$_->mustUnderstand && (!$_->actor || $_->actor eq $SOAP::Constants::NEXT_ACTOR)
$_->mustUnderstand not $_->actor $_->actor eq $SOAP::Constants::NEXT_ACTOR
Truth table0%0/3
not(A) and B
A= not $SOAP::Constants::DO_NOT_CHECK_MUSTUNDERSTANDB= grep {$_->mustUnderstand and !$_->actor || $_->actor eq $SOAP::Constants::NEXT_ACTOR;} $request->dataof($som->headers)
ABresult
0X0
100
111
Truth table0%0/4
A && not(B) or C
A= $_->mustUnderstandB= not $_->actorC= $_->actor eq $SOAP::Constants::NEXT_ACTOR
ABCresult
0XX0
1000
11X1
1011
276 (!$_->actor || $_->actor eq $SOAP::Constants::NEXT_ACTOR)
277 } $request->dataof($som->headers);
278  
279 0 ▶ die "Can't find method element in the message" unless $request->match($som->method);
Branch: 1 branch
BranchTrueFalseTotal
unless $request->match($som->method) 0 0 0
280  
281 0 my($class, $method_uri, $method_name) = $self->find_target($request);
282  
283 0 my @results = eval {
284 0 local $^W;
285 0 my @parameters = $request->paramsin;
286  
287 # SOAP::Trace::dispatch($fullname);
288 0 SOAP::Trace::parameters(@parameters);
289  
290 0 ▶ push @parameters, $request
Branch: 1 branch
BranchTrueFalseTotal
if UNIVERSAL::isa($class, "SOAP::Server::Parameters") 0 0 0
291 if UNIVERSAL::isa($class => 'SOAP::Server::Parameters');
292  
293 SOAP::Server::Object->references(defined $parameters[0] &&
294 ref $parameters[0] &&
295 UNIVERSAL::isa($parameters[0] => $class)
296 0 ▶ ? do {
Branch: 1 branch
BranchTrueFalseTotal
defined $parameters[0] && ref $parameters[0] && UNIVERSAL::isa($parameters[0], $class) ? : 0 0 0
Condition0%0/6
defined $parameters[0] and ref $parameters[0] and UNIVERSAL::isa($parameters[0], $class)
!ll&&!rl&&r
000
defined $parameters[0] and ref $parameters[0]
!ll&&!rl&&r
000
MC/DC0%0/3
defined $parameters[0] and ref $parameters[0] and UNIVERSAL::isa($parameters[0], $class)
defined $parameters[0] ref $parameters[0] UNIVERSAL::isa($parameters[0], $class)
Truth table0%0/4
A and B and C
A= defined $parameters[0]B= ref $parameters[0]C= UNIVERSAL::isa($parameters[0], $class)
ABCresult
0XX0
10X0
1100
1111
297 0 my $object = shift @parameters;
298 0 ▶ SOAP::Server::Object->object(ref $class ? $class : $object)
Branch: 1 branch
BranchTrueFalseTotal
ref $class ? : 0 0 0
299 ->$method_name(SOAP::Server::Object->objects(@parameters)),
300 # send object back as a header
301 # preserve name, specify URI
302 SOAP::Header
303 ->uri($SOAP::Constants::NS_SL_HEADER => $object)
304 ->name($request->dataof($som->method.'/[1]')->name)
305 }
306 : $class->$method_name(SOAP::Server::Object->objects(@parameters))
307 );
308 };
309 0 SOAP::Trace::result(@results);
310  
311 # let application errors pass through with 'Server' code
312 0 ▶ die ref $@ ?
Branch: 3 branches
BranchTrueFalseTotal
if $@ 0 0 0
ref $@ ? : 0 0 0
$@ =~ /^Can't locate object method "$method_name"/ ? : 0 0 0
313 $@ : $@ =~ /^Can't locate object method "$method_name"/ ?
314 "Failed to locate method ($method_name) in class ($class)" :
315 SOAP::Fault->faultcode($SOAP::Constants::FAULT_SERVER)->faultstring($@)
316 if $@;
317  
318 0 return $self->serializer
319 ->prefix('s') # distinguish generated element names between client and server
320 ->uri($method_uri)
321 ->envelope(response => $method_name . 'Response', @results);
322 };
323  
324 # void context
325 0 ▶ return unless defined wantarray;
Branch: 1 branch
BranchTrueFalseTotal
unless defined wantarray 0 0 0
326  
327 # normal result
328 0 ▶ return $result unless $@;
Branch: 1 branch
BranchTrueFalseTotal
unless $@ 0 0 0
329  
330 # check fails, something wrong with message
331 0 ▶ return $self->make_fault($SOAP::Constants::FAULT_CLIENT, $@) unless ref $@;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $@ 0 0 0
332  
333 # died with SOAP::Fault
334 0 ▶ return $self->make_fault($@->faultcode || $SOAP::Constants::FAULT_SERVER,
Branch: 1 branch
BranchTrueFalseTotal
if UNIVERSAL::isa($@, "SOAP::Fault") 0 0 0
Condition0%0/5
$@->faultcode || $SOAP::Constants::FAULT_SERVER
l!l&&r!l&&!r
000
$@->faultstring || 'Application error'
l!l
00
MC/DC0%0/2
$@->faultcode || $SOAP::Constants::FAULT_SERVER
$@->faultcode $SOAP::Constants::FAULT_SERVER
MC/DC0%0/1
$@->faultstring || 'Application error'
$@->faultstring
Truth table0%0/3
A || B
A= $@->faultcodeB= $SOAP::Constants::FAULT_SERVER
ABresult
1X1
011
000
Truth table0%0/2
A
A= $@->faultstring
Aresult
11
00
335 $@->faultstring || 'Application error',
336 $@->faultdetail, $@->faultactor)
337 if UNIVERSAL::isa($@ => 'SOAP::Fault');
338  
339 # died with complex detail
340 0 return $self->make_fault($SOAP::Constants::FAULT_SERVER, 'Application error' => $@);
341  
342 } # end of handle()
343  
344 } # end of BEGIN block
345  
346 sub SOAP::Transport::HTTP::Server::make_response {
347 my $self = shift;
348 my($code, $response) = @_;
349  
350 my $encoding = $1
351 if $response =~ /^<\?xml(?: version="1.0"| encoding="([^"]+)")+\?>/;
352 $response =~ s!(\?>)!$1<?xml-stylesheet type="text/css"?>!
353 if $self->request->content_type eq 'multipart/form-data';
354  
355 $self->options->{is_compress} ||=
356 exists $self->options->{compress_threshold} && eval { require Compress::Zlib };
357  
358 my $compressed = $self->options->{is_compress} &&
359 grep(/\b($COMPRESS|\*)\b/, $self->request->header('Accept-Encoding')) &&
360 ($self->options->{compress_threshold} || 0) < SOAP::Utils::bytelength $response;
361 $response = Compress::Zlib::compress($response) if $compressed;
362 my ($is_multipart) = ($response =~ /content-type:.* boundary="([^\"]*)"/im);
363 $self->response(HTTP::Response->new(
364 $code => undef,
365 HTTP::Headers->new(
366 'SOAPServer' => $self->product_tokens,
367 $compressed ? ('Content-Encoding' => $COMPRESS) : (),
368 'Content-Type' => join('; ', 'text/xml',
369 !$SOAP::Constants::DO_NOT_USE_CHARSET &&
370 $encoding ? 'charset=' . lc($encoding) : ()),
371 'Content-Length' => SOAP::Utils::bytelength $response),
372 $response,
373 ));
374 $self->response->headers->header('Content-Type' => 'Multipart/Related; type="text/xml"; start="<main_envelope>"; boundary="'.$is_multipart.'"') if $is_multipart;
375 }
376  
377 0 ▶sub SOAP::Serializer::envelope {
Subroutine envelope: not called CC=23 SCAR=63.1
378 0 SOAP::Trace::trace('()');
379 0 my $self = shift->new;
380 0 my $type = shift;
381  
382 # SOAP::MIME added the attachments bit here
383 0 my(@parameters, @header, @attachments);
384 0 for (@_) {
385 0 ▶ defined $_ && ref $_ && UNIVERSAL::isa($_ => 'SOAP::Header') ?
Branch: 2 branches
BranchTrueFalseTotal
defined $_ && ref $_ && UNIVERSAL::isa($_, 'SOAP::Header') ? : 0 0 0
UNIVERSAL::isa($_, 'MIME::Entity') ? : 0 0 0
Condition0%0/6
defined $_ and ref $_ and UNIVERSAL::isa($_, "SOAP::Header")
!ll&&!rl&&r
000
defined $_ and ref $_
!ll&&!rl&&r
000
MC/DC0%0/3
defined $_ and ref $_ and UNIVERSAL::isa($_, "SOAP::Header")
defined $_ ref $_ UNIVERSAL::isa($_, "SOAP::Header")
Truth table0%0/4
A and B and C
A= defined $_B= ref $_C= UNIVERSAL::isa($_, "SOAP::Header")
ABCresult
0XX0
10X0
1100
1111
386 push(@header, $_) :
387 UNIVERSAL::isa($_ => 'MIME::Entity') ?
388 push(@attachments, $_) :
389 push(@parameters, $_);
390 }
391 0 ▶ my $header = @header ? SOAP::Data->set_value(@header) : undef;
Branch: 1 branch
BranchTrueFalseTotal
@header ? : 0 0 0
392 0 my($body,$parameters);
393 0 ▶ if ($type eq 'method' || $type eq 'response') {
Branch: 3 branches
BranchTrueFalseTotal
if ($type eq 'method' or $type eq 'response') { } 0 0 0
elsif ($type eq 'fault') { } 0 0 0
elsif ($type eq 'freeform') { } 0 0 0
Condition0%0/3
$type eq "method" or $type eq "response"
l!l&&r!l&&!r
000
MC/DC0%0/2
$type eq "method" or $type eq "response"
$type eq "method" $type eq "response"
Truth table0%0/3
A or B
A= $type eq "method"B= $type eq "response"
ABresult
1X1
011
000
394 0 SOAP::Trace::method(@parameters);
395 0 ▶ my $method = shift(@parameters) or die "Unspecified method for SOAP call\n";
Branch: 1 branch
BranchTrueFalseTotal
my $method = shift @parameters or die "Unspecified method for SOAP call\n" 0 0 0
396 0 ▶ $parameters = @parameters ? SOAP::Data->set_value(@parameters) : undef;
Branch: 1 branch
BranchTrueFalseTotal
@parameters ? : 0 0 0
397 0 ▶ $body = UNIVERSAL::isa($method => 'SOAP::Data')
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::isa($method, 'SOAP::Data') ? : 0 0 0
398 ? $method : SOAP::Data->name($method)->uri($self->uri);
399 0 ▶ $body->set_value($parameters ? \$parameters : ());
Branch: 1 branch
BranchTrueFalseTotal
$parameters ? : 0 0 0
400 } elsif ($type eq 'fault') {
401 0 SOAP::Trace::fault(@parameters);
402 $body = SOAP::Data
403 -> name(SOAP::Serializer::qualify($self->envprefix => 'Fault'))
404 # commented on 2001/03/28 because of failing in ApacheSOAP
405 # need to find out more about it
406 # -> attr({'xmlns' => ''})
407 -> value(\SOAP::Data->set_value(
408 SOAP::Data->name(faultcode => SOAP::Serializer::qualify($self->envprefix => $parameters[0])),
409 SOAP::Data->name(faultstring => $parameters[1]),
410 0 ▶ defined($parameters[2]) ? SOAP::Data->name(detail => do{my $detail = $parameters[2]; ref $detail ? \$detail : $detail}) : (),
Branch: 3 branches
BranchTrueFalseTotal
defined $parameters[2] ? : 0 0 0
ref $detail ? : 0 0 0
defined $parameters[3] ? : 0 0 0
411 defined($parameters[3]) ? SOAP::Data->name(faultactor => $parameters[3]) : (),
412 ));
413 } elsif ($type eq 'freeform') {
414 0 SOAP::Trace::freeform(@parameters);
415 0 $body = SOAP::Data->set_value(@parameters);
416 } else {
417 0 die "Wrong type of envelope ($type) for SOAP call\n";
418 }
419  
420 0 $self->seen({}); # reinitialize multiref table
421 0 ▶ my($encoded) = $self->encode_object(
Branch: 1 branch
BranchTrueFalseTotal
$header ? : 0 0 0
422 SOAP::Data->name(SOAP::Serializer::qualify($self->envprefix => 'Envelope') => \SOAP::Data->value(
423 ($header ? SOAP::Data->name(SOAP::Serializer::qualify($self->envprefix => 'Header') => \$header) : ()),
424 SOAP::Data->name(SOAP::Serializer::qualify($self->envprefix => 'Body') => \$body)
425 ))->attr($self->attr)
426 );
427 0 ▶ $self->signature($parameters->signature) if ref $parameters;
Branch: 1 branch
BranchTrueFalseTotal
if ref $parameters 0 0 0
428  
429 # IMHO multirefs should be encoded after Body, but only some
430 # toolkits understand this encoding, so we'll keep them for now (04/15/2001)
431 # as the last element inside the Body
432 # v -------------- subelements of Envelope
433 # vv -------- last of them (Body)
434 # v --- subelements
435 0 ▶ push(@{$encoded->[2]->[-1]->[2]}, $self->encode_multirefs) if ref $encoded->[2]->[-1]->[2];
Branch: 1 branch
BranchTrueFalseTotal
if ref $encoded->[2][-1][2] 0 0 0
436  
437 # SOAP::MIME magic goes here...
438 0 ▶ if (@attachments) {
Branch: 1 branch
BranchTrueFalseTotal
if (@attachments) 0 0 0
439 0 my $top = MIME::Entity->build(
440 'Type' => "Multipart/Related"
441 );
442 0 $top->attach(
443 'Type' => 'text/xml',
444 'Content-Transfer-Encoding' => '8bit',
445 'Content-Location' => '/main_envelope',
446 'Content-ID' => '<main_envelope>',
447 'Data' => $self->xmlize($encoded)
448 );
449 0 foreach $a (@attachments) {
450 0 $top->add_part($a);
451 }
452 # Each Transport layer is responsible for setting the proper top level MIME type with a
453 # start="<main_envelope>" mime attribute.
454 # my ($boundary) = $top->head->multipart_boundary;
455 # $headers->header('Content-Type' => 'Multipart/Related; type="text/xml"; start="<main_envelope>"; boundary="'.$boundary.'"');
456 0 return $top->stringify;
457 }
458 0 return $self->xmlize($encoded);
459 }
460  
461  
462 #############################################################################
463 # Many hacks and additional functionality tweaked to make this work. All code
464 # changes made by me to get this to work are identified by a 'MIME:' comment.
465 #
466 package SOAP::Transport::HTTP::Client;
467 1 ▶use Compress::Zlib;
Subroutine BEGIN: called CC=1 SCAR=0.0
468 1 ▶use SOAP::Transport::HTTP;
Subroutine BEGIN: called CC=1 SCAR=0.0
469  
470 0 ▶sub send_receive {
Subroutine send_receive: not called CC=37 SCAR=72.5
471 0 my($self, %parameters) = @_;
472 my($envelope, $endpoint, $action, $encoding, $headers) =
473 0 @parameters{qw(envelope endpoint action encoding headers)};
474 # MIME: ^^^^^^^
475 # MIME: I modified this because the transport layer needs access to the
476 # HTTP headers to properly set the content-type
477 0 ▶ $endpoint ||= $self->endpoint;
Condition0%0/3
$endpoint ||= $self->endpoint
l!l&&r!l&&!r
000
MC/DC0%0/2
$endpoint ||= $self->endpoint
$endpoint $self->endpoint
Truth table0%0/3
A ||= B
A= $endpointB= $self->endpoint
ABresult
1X1
011
000
478  
479 0 my $method='POST';
480 0 $COMPRESS='gzip';
481 0 my $resp;
482  
483 $self->options->{is_compress}
484 ||= exists $self->options->{compress_threshold}
485 0 ▶ && eval { require Compress::Zlib };
Condition0%0/6
$self->options->{"is_compress"} ||= exists $self->options->{"compress_threshold"} && eval { do { require Compress::Zlib } }
l!l&&r!l&&!r
000
exists $self->options->{'compress_threshold'} && eval { do { require Compress::Zlib } }
!ll&&!rl&&r
000
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
486  
487 COMPRESS: {
488  
489 0 my $compressed
490 = !exists $SOAP::Transport::HTTP::Client::nocompress{$endpoint} &&
491 $self->options->{is_compress} &&
492 0 ▶ ($self->options->{compress_threshold} || 0) < length $envelope;
Condition0%0/8
!exists $nocompress{$endpoint} && $self->options->{'is_compress'} && ($self->options->{'compress_threshold'} || 0) < length $envelope
!ll&&!rl&&r
000
not exists $nocompress{$endpoint} and $self->options->{"is_compress"}
!ll&&!rl&&r
000
$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 table0%0/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
493 0 ▶ $envelope = Compress::Zlib::memGzip($envelope) if $compressed;
Branch: 1 branch
BranchTrueFalseTotal
if $compressed 0 0 0
494  
495 0 while (1) {
496  
497 # check cache for redirect
498 $endpoint = $SOAP::Transport::HTTP::Client::redirect{$endpoint}
499 0 ▶ if exists $SOAP::Transport::HTTP::Client::redirect{$endpoint};
Branch: 1 branch
BranchTrueFalseTotal
if exists $redirect{$endpoint} 0 0 0
500 # check cache for M-POST
501 $method = 'M-POST'
502 0 ▶ if exists $SOAP::Transport::HTTP::Client::mpost{$endpoint};
Branch: 1 branch
BranchTrueFalseTotal
if exists $mpost{$endpoint} 0 0 0
503  
504 0 ▶ my $req =
Branch: 1 branch
BranchTrueFalseTotal
defined $headers ? : 0 0 0
505 HTTP::Request->new($method => $endpoint,
506 (defined $headers ? $headers : $HTTP::Headers->new),
507 # MIME: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
508 # MIME: This is done so that the HTTP Headers instance is properly
509 # created.
510 $envelope);
511 0 $req->protocol('HTTP/1.1');
512  
513 $req->proxy_authorization_basic($ENV{'HTTP_proxy_user'},
514 $ENV{'HTTP_proxy_pass'})
515 0 ▶ if ($ENV{'HTTP_proxy_user'} && $ENV{'HTTP_proxy_pass'});
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"HTTP_proxy_user"} and $ENV{"HTTP_proxy_pass"} 0 0 0
Condition0%0/3
$ENV{"HTTP_proxy_user"} and $ENV{"HTTP_proxy_pass"}
!ll&&!rl&&r
000
MC/DC0%0/2
$ENV{"HTTP_proxy_user"} and $ENV{"HTTP_proxy_pass"}
$ENV{"HTTP_proxy_user"} $ENV{"HTTP_proxy_pass"}
Truth table0%0/3
A and B
A= $ENV{"HTTP_proxy_user"}B= $ENV{"HTTP_proxy_pass"}
ABresult
0X0
100
111
516 # by Murray Nesbitt
517  
518 0 ▶ if ($method eq 'M-POST') {
Branch: 1 branch
BranchTrueFalseTotal
if ($method eq 'M-POST') { } 0 0 0
519 0 my $prefix = sprintf '%04d', int(rand(1000));
520 0 $req->header(Man => qq!"$SOAP::Constants::NS_ENV"; ns=$prefix!);
521 0 ▶ $req->header("$prefix-SOAPAction" => $action) if defined $action;
Branch: 1 branch
BranchTrueFalseTotal
if defined $action 0 0 0
522 } else {
523 0 ▶ $req->header(SOAPAction => $action) if defined $action;
Branch: 1 branch
BranchTrueFalseTotal
if defined $action 0 0 0
524 }
525  
526 # allow compress if present and let server know we could handle it
527 0 $req->header(Accept => ['text/xml', 'multipart/*']);
528  
529 $req->header('Accept-Encoding' =>
530 [$SOAP::Transport::HTTP::Client::COMPRESS])
531 0 ▶ if $self->options->{is_compress};
Branch: 1 branch
BranchTrueFalseTotal
if $self->options->{"is_compress"} 0 0 0
532 0 ▶ $req->content_encoding($SOAP::Transport::HTTP::Client::COMPRESS)
Branch: 1 branch
BranchTrueFalseTotal
if $compressed 0 0 0
533 if $compressed;
534  
535 0 ▶ if(!$req->content_type){
Branch: 2 branches
BranchTrueFalseTotal
if (not $req->content_type) { } 0 0 0
elsif (not $SOAP::Constants::DO_NOT_USE_CHARSET and $encoding) { } 0 0 0
536 0 ▶ $req->content_type(join '; ',
Branch: 1 branch
BranchTrueFalseTotal
!$SOAP::Constants::DO_NOT_USE_CHARSET && $encoding ? : 0 0 0
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
537 'text/xml',
538 !$SOAP::Constants::DO_NOT_USE_CHARSET && $encoding ?
539 'charset=' . lc($encoding) : ());
540 ▶ }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
541 0 my $tmpType=$req->headers->header('Content-type');
542 # MIME: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
543 # MIME: This was changed from $req->content_type which was a bug,
544 # because it does not properly maintain the entire content-type
545 # header.
546 0 $req->content_type($tmpType.'; charset=' . lc($encoding));
547 }
548  
549 0 $req->content_length(length($envelope));
550 0 SOAP::Trace::transport($req);
551 0 SOAP::Trace::debug($req->as_string);
552  
553 0 ▶ $self->SUPER::env_proxy if $ENV{'HTTP_proxy'};
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"HTTP_proxy"} 0 0 0
554  
555 0 $resp = $self->SUPER::request($req);
556  
557 0 SOAP::Trace::transport($resp);
558 0 SOAP::Trace::debug($resp->as_string);
559  
560 # 100 OK, continue to read?
561 0 ▶ if (($resp->code == 510 || $resp->code == 501) && $method ne 'M-POST') {
Branch: 2 branches
BranchTrueFalseTotal
if ($resp->code == 510 || $resp->code == 501 and $method ne 'M-POST') { } 0 0 0
elsif ($resp->code == 415 and $compressed) { } 0 0 0
Condition0%0/6
$resp->code == 510 || $resp->code == 501 and $method ne "M-POST"
!ll&&!rl&&r
000
$resp->code == 510 or $resp->code == 501
l!l&&r!l&&!r
000
MC/DC0%0/3
$resp->code == 510 || $resp->code == 501 and $method ne "M-POST"
$resp->code == 510 $resp->code == 501 $method ne "M-POST"
Truth table0%0/5
A or B and C
A= $resp->code == 510B= $resp->code == 501C= $method ne "M-POST"
ABCresult
00X0
1X00
0100
1X11
0111
562 0 $SOAP::Transport::HTTP::Client::mpost{$endpoint} = 1;
563 ▶ } elsif ($resp->code == 415 && $compressed) {
Condition0%0/3
$resp->code == 415 and $compressed
!ll&&!rl&&r
000
MC/DC0%0/2
$resp->code == 415 and $compressed
$resp->code == 415 $compressed
Truth table0%0/3
A and B
A= $resp->code == 415B= $compressed
ABresult
0X0
100
111
564 # 415 Unsupported Media Type
565 0 $SOAP::Transport::HTTP::Client::nocompress{$endpoint} = 1;
566 0 $envelope = Compress::Zlib::memGunzip($envelope);
567 0 redo COMPRESS; # try again without compression
568 } else {
569 0 last;
570 }
571 }
572 }
573  
574 0 ▶ $SOAP::Transport::HTTP::Client::redirect{$endpoint} = $resp->request->url
Branch: 1 branch
BranchTrueFalseTotal
if $resp->previous and $resp->previous->is_redirect 0 0 0
Condition0%0/3
$resp->previous and $resp->previous->is_redirect
!ll&&!rl&&r
000
MC/DC0%0/2
$resp->previous and $resp->previous->is_redirect
$resp->previous $resp->previous->is_redirect
Truth table0%0/3
A and B
A= $resp->previousB= $resp->previous->is_redirect
ABresult
0X0
100
111
575 if $resp->previous && $resp->previous->is_redirect;
576  
577 0 $self->code($resp->code);
578 0 $self->message($resp->message);
579 0 $self->is_success($resp->is_success);
580 0 $self->status($resp->status_line);
581  
582 my $content =
583 ($resp->content_encoding || '')
584 =~ /\b$SOAP::Transport::HTTP::Client::COMPRESS\b/o &&
585 $self->options->{is_compress} ?
586 0 ▶ Compress::Zlib::memGunzip($resp->content)
Branch: 2 branches
BranchTrueFalseTotal
($resp->content_encoding || '') =~ /\b$COMPRESS\b/o && $self->options->{'is_compress'} ? : 0 0 0
($resp->content_encoding || '') =~ /\S/ ? : 0 0 0
Condition0%0/7
($resp->content_encoding || "") =~ /\b$COMPRESS\b/o and $self->options->{"is_compress"}
!ll&&!rl&&r
000
$resp->content_encoding || ''
l!l
00
$resp->content_encoding || ''
l!l
00
MC/DC0%0/2
($resp->content_encoding || "") =~ /\b$COMPRESS\b/o and $self->options->{"is_compress"}
$resp->content_encoding $self->options->{"is_compress"}
Truth table0%0/3
A and B
A= $resp->content_encodingB= $self->options->{"is_compress"}
ABresult
0X0
100
111
587 : ($resp->content_encoding || '') =~ /\S/
588 0 ? die "Can't understand returned Content-Encoding (@{[$resp->content_encoding]})\n"
589 : $resp->content;
590 0 ▶ $resp->content_type =~ m!^multipart/!
Branch: 1 branch
BranchTrueFalseTotal
$resp->content_type =~ m[^multipart/] ? : 0 0 0
591 ? join("\n", $resp->headers_as_string, $content) : $content;
592 }
593  
594 ##############################################################################
595 ##############################################################################
596  
597 1 1;
598  
599 __END__
↑ Summary