HTTP/Methods.pm

filter: Statementstmt 77.4% 323 / 417 Branchbran 60.4% 139 / 230 Conditioncond 42.4% 42 / 99 MC/DCmcdc 16.9% 10 / 59 Subroutinesub 63.6% 21 / 33 Podpod 0.0% 0 / 18 totaltotal 62.5% 535 / 856 CC 158 SCAR 36.6
CC
158
Cov
68%
read_entity_body
103.3
can_read
46.3
format_request
35.5
CRAP 38.9
↑ Summary HTTPS.pm »
1 package Net::HTTP::Methods;
2 5 our $VERSION = '6.24';
3 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 5 my $CRLF = "\015\012"; # "\r\n" is not portable
8  
9 *_bytes = defined(&utf8::downgrade) ?
10 20 ▶ sub {
Subroutine __ANON__: called CC=2 SCAR=9.2
11 20 ▶ unless (utf8::downgrade($_[0], 1)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (utf8::downgrade($_[0], 1)) 0 20 20
12 0 require Carp;
13 0 Carp::croak("Wide character in HTTP request (bytes required)");
14 }
15 20 return $_[0];
16 }
17 :
18 0 ▶ sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
19 0 return $_[0];
20 5 ▶ };
Branch: 1 branch
BranchTrueFalseTotal
defined &utf8::downgrade ? : 5 0 5
21  
22  
23 5 ▶sub new {
Subroutine new: called CC=2 SCAR=6.9
Pod undocumented
24 5 my $class = shift;
25 5 ▶ unshift(@_, "Host") if @_ == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 1 4 5
26 5 my %cnf = @_;
27 5 require Symbol;
28 5 my $self = bless Symbol::gensym(), $class;
29 5 return $self->http_configure(\%cnf);
30 }
31  
32 8 ▶sub http_configure {
Subroutine http_configure: called CC=20 SCAR=30.1
Pod undocumented
33 8 my($self, $cnf) = @_;
34  
35 8 ▶ die "Listen option not allowed" if $cnf->{Listen};
Branch: 1 branch
BranchTrueFalseTotal
if $cnf->{"Listen"} 0 8 8
36 8 my $explicit_host = (exists $cnf->{Host});
37 8 my $host = delete $cnf->{Host};
38 # All this because $cnf->{PeerAddr} = 0 is actually valid.
39 8 my $peer;
40 8 for my $key (qw{PeerAddr PeerHost}) {
41 14 ▶ next if !defined($cnf->{$key}) || q{} eq $cnf->{$key};
Branch: 1 branch
BranchTrueFalseTotal
if not defined $cnf->{$key} or "" eq $cnf->{$key} 12 2 14
Condition66%2/3
not defined $cnf->{$key} or "" eq $cnf->{$key}
l!l&&r!l&&!r
1202
MC/DC50%1/2
not defined $cnf->{$key} or "" eq $cnf->{$key}
not defined $cnf->{$key} "" eq $cnf->{$key}
Truth table66%2/3
not(A) or B
A= not defined $cnf->{$key}B= "" eq $cnf->{$key}
ABresult
1X1
011
000
42 2 $peer = $cnf->{$key};
43 2 last;
44 }
45 8 ▶ if (!defined $peer) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $peer) 6 2 8
46 6 ▶ die "No Host option provided" unless $host;
Branch: 1 branch
BranchTrueFalseTotal
unless $host 0 6 6
47 6 $cnf->{PeerAddr} = $peer = $host;
48 }
49  
50 # CONNECTIONS
51 # PREFER: port number from PeerAddr, then PeerPort, then http_default_port
52 8 my $peer_uri = URI->new("http://$peer");
53 8 ▶ $cnf->{"PeerPort"} = $peer_uri->_port || $cnf->{PeerPort} || $self->http_default_port;
Condition83%5/6
$peer_uri->_port || $cnf->{'PeerPort'} || $self->http_default_port
l!l&&r!l&&!r
260
$peer_uri->_port or $cnf->{"PeerPort"}
l!l&&r!l&&!r
116
MC/DC0%0/3
$peer_uri->_port || $cnf->{'PeerPort'} || $self->http_default_port
$peer_uri->_port $cnf->{"PeerPort"} $self->http_default_port
Truth table75%3/4
A or B || C
A= $peer_uri->_portB= $cnf->{"PeerPort"}C= $self->http_default_port
ABCresult
1XX1
01X1
0011
0000
54 8 $cnf->{"PeerAddr"} = $peer_uri->host;
55  
56 # HOST header:
57 # If specified but blank, ignore.
58 # If specified with a value, add the port number
59 # If not specified, set to PeerAddr and port number
60 # ALWAYS: If IPv6 address, use [brackets] (thanks to the URI package)
61 # ALWAYS: omit port number if http_default_port
62 8 ▶ if (($host) || (! $explicit_host)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($host or not $explicit_host) 7 1 8
Condition100%3/3
$host or not $explicit_host
l!l&&r!l&&!r
611
MC/DC100%2/2
$host or not $explicit_host
$host not $explicit_host
Truth table100%3/3
A or not(B)
A= $hostB= not $explicit_host
ABresult
1X1
011
000
63 7 ▶ my $uri = ($explicit_host) ? URI->new("http://$host") : $peer_uri->clone;
Branch: 1 branch
BranchTrueFalseTotal
$explicit_host ? : 6 1 7
64 7 ▶ if (!$uri->_port) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($uri->_port) 6 1 7
65 # Always use *our* $self->http_default_port instead of URI's (Covers HTTP, HTTPS)
66 6 ▶ $uri->port( $cnf->{PeerPort} || $self->http_default_port);
Condition33%1/3
$cnf->{'PeerPort'} || $self->http_default_port
l!l&&r!l&&!r
600
MC/DC0%0/2
$cnf->{'PeerPort'} || $self->http_default_port
$cnf->{'PeerPort'} $self->http_default_port
Truth table33%1/3
A || B
A= $cnf->{'PeerPort'}B= $self->http_default_port
ABresult
1X1
011
000
67 }
68 7 my $host_port = $uri->host_port; # Returns host:port or [ipv6]:port
69 7 my $remove = ":" . $self->http_default_port; # we want to remove the default port number
70 7 ▶ if (substr($host_port,0-length($remove)) eq $remove) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($host_port, 0 - length($remove)) eq $remove) 5 2 7
71 5 substr($host_port,0-length($remove)) = "";
72 }
73 7 $host = $host_port;
74 }
75  
76 8 $cnf->{Proto} = 'tcp';
77  
78 8 my $keep_alive = delete $cnf->{KeepAlive};
79 8 my $http_version = delete $cnf->{HTTPVersion};
80 8 ▶ $http_version = "1.1" unless defined $http_version;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $http_version 8 0 8
81 8 my $peer_http_version = delete $cnf->{PeerHTTPVersion};
82 8 ▶ $peer_http_version = "1.0" unless defined $peer_http_version;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $peer_http_version 6 2 8
83 8 my $send_te = delete $cnf->{SendTE};
84 8 my $max_line_length = delete $cnf->{MaxLineLength};
85 8 ▶ $max_line_length = 8*1024 unless defined $max_line_length;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $max_line_length 6 2 8
86 8 my $max_header_lines = delete $cnf->{MaxHeaderLines};
87 8 ▶ $max_header_lines = 128 unless defined $max_header_lines;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $max_header_lines 8 0 8
88  
89 8 ▶ return undef unless $self->http_connect($cnf);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->http_connect($cnf) 1 7 8
90  
91 7 $self->host($host);
92 7 $self->keep_alive($keep_alive);
93 7 $self->send_te($send_te);
94 7 $self->http_version($http_version);
95 7 $self->peer_http_version($peer_http_version);
96 7 $self->max_line_length($max_line_length);
97 7 $self->max_header_lines($max_header_lines);
98  
99 7 ${*$self}{'http_buf'} = "";
100  
101 7 return $self;
102 }
103  
104 11 ▶sub http_default_port {
Subroutine http_default_port: called CC=1 SCAR=0.0
Pod undocumented
105 11 80;
106 }
107  
108 # set up property accessors
109 5 for my $method (qw(host keep_alive send_te max_line_length max_header_lines peer_http_version)) {
110 30 my $prop_name = "http_" . $method;
111 5 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
112 85 ▶ *$method = sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
113 85 my $self = shift;
114 85 my $old = ${*$self}{$prop_name};
115 85 ▶ ${*$self}{$prop_name} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 43 42 85
116 85 return $old;
117 30 };
118 }
119  
120 # we want this one to be a bit smarter
121 8 ▶sub http_version {
Subroutine http_version: called CC=5 SCAR=17.2
Pod undocumented
122 8 my $self = shift;
123 8 my $old = ${*$self}{'http_version'};
124 8 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 8 0 8
125 8 my $v = shift;
126 8 ▶ $v = "1.0" if $v eq "1"; # float
Branch: 1 branch
BranchTrueFalseTotal
if $v eq 1 0 8 8
127 8 ▶ unless ($v eq "1.0" or $v eq "1.1") {
Branch: 1 branch
BranchTrueFalseTotal
unless ($v eq "1.0" or $v eq "1.1") 0 8 8
Condition66%2/3
$v eq "1.0" or $v eq "1.1"
l!l&&r!l&&!r
170
MC/DC0%0/2
$v eq "1.0" or $v eq "1.1"
$v eq "1.0" $v eq "1.1"
Truth table66%2/3
A or B
A= $v eq "1.0"B= $v eq "1.1"
ABresult
1X1
011
000
128 0 require Carp;
129 0 Carp::croak("Unsupported HTTP version '$v'");
130 }
131 8 ${*$self}{'http_version'} = $v;
132 }
133 8 $old;
134 }
135  
136 20 ▶sub format_request {
Subroutine format_request: called CC=22 SCAR=35.7
Pod undocumented
137 20 my $self = shift;
138 20 my $method = shift;
139 20 my $uri = shift;
140  
141 20 ▶ my $content = (@_ % 2) ? pop : "";
Branch: 1 branch
BranchTrueFalseTotal
@_ % 2 ? : 0 20 20
142  
143 20 for ($method, $uri) {
144 40 require Carp;
145 40 ▶ Carp::croak("Bad method or uri") if /\s/ || !length;
Branch: 1 branch
BranchTrueFalseTotal
if /\s/ or not length $_ 0 40 40
Condition33%1/3
/\s/ or not length $_
l!l&&r!l&&!r
0040
MC/DC0%0/2
/\s/ or not length $_
/\s/ not length $_
Truth table33%1/3
A or not(B)
A= /\s/B= not length $_
ABresult
1X1
011
000
146 }
147  
148 20 push(@{${*$self}{'http_request_method'}}, $method);
149 20 my $ver = ${*$self}{'http_version'};
150 20 ▶ my $peer_ver = ${*$self}{'http_peer_http_version'} || "1.0";
Condition50%1/2
do { *$self }->{'http_peer_http_version'} || '1.0'
l!l
200
MC/DC0%0/1
do { *$self }->{'http_peer_http_version'} || '1.0'
do { *$self }->{'http_peer_http_version'}
Truth table50%1/2
A
A= do { *$self }->{'http_peer_http_version'}
Aresult
11
00
151  
152 20 my @h;
153 my @connection;
154 20 my %given = (host => 0, "content-length" => 0, "te" => 0);
155 20 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 12 20 32
156 12 my($k, $v) = splice(@_, 0, 2);
157 12 my $lc_k = lc($k);
158 12 ▶ if ($lc_k eq "connection") {
Branch: 1 branch
BranchTrueFalseTotal
if ($lc_k eq "connection") 0 12 12
159 0 $v =~ s/^\s+//;
160 0 $v =~ s/\s+$//;
161 0 push(@connection, split(/\s*,\s*/, $v));
162 0 next;
163 }
164 12 ▶ if (exists $given{$lc_k}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $given{$lc_k}) 0 12 12
165 0 $given{$lc_k}++;
166 }
167 12 push(@h, "$k: $v");
168 }
169  
170 20 ▶ if (length($content) && !$given{'content-length'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $content and not $given{"content-length"}) 0 20 20
Condition33%1/3
length $content and not $given{"content-length"}
!ll&&!rl&&r
2000
MC/DC0%0/2
length $content and not $given{"content-length"}
length $content not $given{"content-length"}
Truth table33%1/3
A and not(B)
A= length $contentB= not $given{"content-length"}
ABresult
0X0
100
111
171 0 push(@h, "Content-Length: " . length($content));
172 }
173  
174 20 my @h2;
175 20 ▶ if ($given{te}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($given{'te'}) { } 0 20 20
elsif ($self->send_te and gunzip_ok()) { } 0 40 40
176 0 ▶ push(@connection, "TE") unless grep lc($_) eq "te", @connection;
Branch: 1 branch
BranchTrueFalseTotal
unless grep((lc $_ eq "te"), @connection) 0 0 0
177 }
178 ▶ elsif ($self->send_te && gunzip_ok()) {
Condition33%1/3
$self->send_te and gunzip_ok()
!ll&&!rl&&r
2000
MC/DC0%0/2
$self->send_te and gunzip_ok()
$self->send_te gunzip_ok()
Truth table33%1/3
A and B
A= $self->send_teB= gunzip_ok()
ABresult
0X0
100
111
179 # gzip is less wanted since the IO::Uncompress::Gunzip interface for
180 # it does not really allow chunked decoding to take place easily.
181 0 push(@h2, "TE: deflate,gzip;q=0.3");
182 0 push(@connection, "TE");
183 }
184  
185 20 ▶ unless (grep lc($_) eq "close", @connection) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep((lc $_ eq "close"), @connection)) 20 0 20
186 20 ▶ if ($self->keep_alive) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->keep_alive) { } 12 8 20
187 12 ▶ if ($peer_ver eq "1.0") {
Branch: 1 branch
BranchTrueFalseTotal
if ($peer_ver eq "1.0") 4 8 12
188 # from looking at Netscape's headers
189 4 push(@h2, "Keep-Alive: 300");
190 4 unshift(@connection, "Keep-Alive");
191 }
192 }
193 else {
194 8 ▶ push(@connection, "close") if $ver ge "1.1";
Branch: 1 branch
BranchTrueFalseTotal
if $ver ge "1.1" 6 2 8
195 }
196 }
197 20 ▶ push(@h2, "Connection: " . join(", ", @connection)) if @connection;
Branch: 1 branch
BranchTrueFalseTotal
if @connection 10 10 20
198 20 ▶ unless ($given{host}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($given{"host"}) 20 0 20
199 20 my $h = ${*$self}{'http_host'};
200 20 ▶ push(@h2, "Host: $h") if $h;
Branch: 1 branch
BranchTrueFalseTotal
if $h 18 2 20
201 }
202  
203 20 return _bytes(join($CRLF, "$method $uri HTTP/$ver", @h2, @h, "", $content));
204 }
205  
206  
207 20 ▶sub write_request {
Subroutine write_request: called CC=1 SCAR=0.0
Pod undocumented
208 20 my $self = shift;
209 20 $self->print($self->format_request(@_));
210 }
211  
212 0 ▶sub format_chunk {
Subroutine format_chunk: not called CC=3 SCAR=24.8
Pod undocumented
213 0 my $self = shift;
214 0 ▶ return $_[0] unless defined($_[0]) && length($_[0]);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[0] and length $_[0] 0 0 0
Condition0%0/3
defined $_[0] and length $_[0]
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_[0] and length $_[0]
defined $_[0] length $_[0]
Truth table0%0/3
A and B
A= defined $_[0]B= length $_[0]
ABresult
0X0
100
111
215 0 return _bytes(sprintf("%x", length($_[0])) . $CRLF . $_[0] . $CRLF);
216 }
217  
218 0 ▶sub write_chunk {
Subroutine write_chunk: not called CC=3 SCAR=24.8
Pod undocumented
219 0 my $self = shift;
220 0 ▶ return 1 unless defined($_[0]) && length($_[0]);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[0] and length $_[0] 0 0 0
Condition0%0/3
defined $_[0] and length $_[0]
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_[0] and length $_[0]
defined $_[0] length $_[0]
Truth table0%0/3
A and B
A= defined $_[0]B= length $_[0]
ABresult
0X0
100
111
221 0 $self->print(_bytes(sprintf("%x", length($_[0])) . $CRLF . $_[0] . $CRLF));
222 }
223  
224 0 ▶sub format_chunk_eof {
Subroutine format_chunk_eof: not called CC=2 SCAR=17.9
Pod undocumented
225 0 my $self = shift;
226 0 my @h;
227 0 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
228 0 push(@h, sprintf "%s: %s$CRLF", splice(@_, 0, 2));
229 }
230 0 return _bytes(join("", "0$CRLF", @h, $CRLF));
231 }
232  
233 0 ▶sub write_chunk_eof {
Subroutine write_chunk_eof: not called CC=1 SCAR=6.9
Pod undocumented
234 0 my $self = shift;
235 0 $self->print($self->format_chunk_eof(@_));
236 }
237  
238  
239 984 ▶sub my_read {
Subroutine my_read: called CC=5 SCAR=16.2
Pod undocumented
240 984 ▶ die if @_ > 3;
Branch: 1 branch
BranchTrueFalseTotal
if @_ > 3 0 984 984
241 984 my $self = shift;
242 984 my $len = $_[1];
243 984 for (${*$self}{'http_buf'}) {
244 984 ▶ if (length) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $_) { } 68 916 984
245 68 $_[0] = substr($_, 0, $len, "");
246 68 return length($_[0]);
247 }
248 else {
249 916 ▶ die "read timeout" unless $self->can_read;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->can_read 0 916 916
250 916 return $self->sysread($_[0], $len);
251 }
252 }
253 }
254  
255  
256 161 ▶sub my_readline {
Subroutine my_readline: called CC=17 SCAR=35.4
Pod undocumented
257 161 my $self = shift;
258 161 my $what = shift;
259 161 for (${*$self}{'http_buf'}) {
260 161 my $max_line_length = ${*$self}{'http_max_line_length'};
261 161 my $pos;
262 161 while (1) {
263 # find line ending
264 642 $pos = index($_, "\012");
265 642 ▶ last if $pos >= 0;
Branch: 1 branch
BranchTrueFalseTotal
if $pos >= 0 161 481 642
266 481 ▶ die "$what line too long (limit is $max_line_length)"
Branch: 1 branch
BranchTrueFalseTotal
if $max_line_length and length $_ > $max_line_length 0 481 481
Condition33%1/3
$max_line_length and length $_ > $max_line_length
!ll&&!rl&&r
04810
MC/DC0%0/2
$max_line_length and length $_ > $max_line_length
$max_line_length length $_ > $max_line_length
Truth table33%1/3
A and B
A= $max_line_lengthB= length $_ > $max_line_length
ABresult
0X0
100
111
267 if $max_line_length && length($_) > $max_line_length;
268  
269 # need to read more data to find a line ending
270 481 my $new_bytes = 0;
271  
272 READ:
273 { # wait until bytes start arriving
274 481 ▶ $self->can_read
Branch: 1 branch
BranchTrueFalseTotal
$self->can_read or die "read timeout" 481 0 481
275 or die "read timeout";
276  
277 # consume all incoming bytes
278 481 my $bytes_read = $self->sysread($_, 1024, length);
279 481 ▶ if(defined $bytes_read) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $bytes_read) { } 481 0 481
elsif ($!{'EINTR'} or $!{'EAGAIN'} or $!{'EWOULDBLOCK'}) { } 0 0 0
280 481 $new_bytes += $bytes_read;
281 }
282 1 ▶ elsif($!{EINTR} || $!{EAGAIN} || $!{EWOULDBLOCK}) {
Subroutine BEGIN: called CC=1 SCAR=2.6
Condition0%0/6
$!{"EINTR"} or $!{"EAGAIN"} or $!{"EWOULDBLOCK"}
l!l&&r!l&&!r
000
$!{"EINTR"} or $!{"EAGAIN"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$!{"EINTR"} or $!{"EAGAIN"} or $!{"EWOULDBLOCK"}
$!{"EINTR"} $!{"EAGAIN"} $!{"EWOULDBLOCK"}
Truth table0%0/4
A or B or C
A= $!{"EINTR"}B= $!{"EAGAIN"}C= $!{"EWOULDBLOCK"}
ABCresult
1XX1
01X1
0011
0000
283 0 redo READ;
284 }
285 else {
286 # if we have already accumulated some data let's at
287 # least return that as a line
288 0 ▶ length or die "$what read failed: $!";
Branch: 1 branch
BranchTrueFalseTotal
length $_ or die "$what read failed: $!" 0 0 0
289 }
290  
291 # no line-ending, no new bytes
292 481 ▶ return length($_) ? substr($_, 0, length($_), "") : undef
Branch: 2 branches
BranchTrueFalseTotal
if $new_bytes == 0 0 481 481
length $_ ? : 0 0 0
293 if $new_bytes==0;
294 }
295 }
296 161 ▶ die "$what line too long ($pos; limit is $max_line_length)"
Branch: 1 branch
BranchTrueFalseTotal
if $max_line_length and $pos > $max_line_length 0 161 161
Condition33%1/3
$max_line_length and $pos > $max_line_length
!ll&&!rl&&r
01610
MC/DC0%0/2
$max_line_length and $pos > $max_line_length
$max_line_length $pos > $max_line_length
Truth table33%1/3
A and B
A= $max_line_lengthB= $pos > $max_line_length
ABresult
0X0
100
111
297 if $max_line_length && $pos > $max_line_length;
298  
299 161 my $line = substr($_, 0, $pos+1, "");
300 161 ▶ $line =~ s/(\015?\012)\z// || die "Assert";
Branch: 1 branch
BranchTrueFalseTotal
$line =~ s/(\015?\012)\z// or die "Assert" 161 0 161
301 161 ▶ return wantarray ? ($line, $1) : $line;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 20 141 161
302 }
303 }
304  
305  
306 1394 ▶sub can_read {
Subroutine can_read: called CC=16 SCAR=38.3
Pod undocumented
307 1394 my $self = shift;
308 1394 ▶ return 1 unless defined(fileno($self));
Branch: 1 branch
BranchTrueFalseTotal
unless defined fileno $self 500 894 1394
309 894 ▶ return 1 if $self->isa('IO::Socket::SSL') && $self->pending;
Branch: 1 branch
BranchTrueFalseTotal
if $self->isa("IO::Socket::SSL") and $self->pending 876 18 894
Condition100%3/3
$self->isa("IO::Socket::SSL") and $self->pending
!ll&&!rl&&r
216876
MC/DC100%2/2
$self->isa("IO::Socket::SSL") and $self->pending
$self->isa("IO::Socket::SSL") $self->pending
Truth table100%3/3
A and B
A= $self->isa("IO::Socket::SSL")B= $self->pending
ABresult
0X0
100
111
310 18 ▶ return 1 if $self->isa('Net::SSL') && $self->can('pending') && $self->pending;
Branch: 1 branch
BranchTrueFalseTotal
if $self->isa("Net::SSL") and $self->can("pending") and $self->pending 0 18 18
Condition33%2/6
$self->isa("Net::SSL") and $self->can("pending") and $self->pending
!ll&&!rl&&r
1800
$self->isa("Net::SSL") and $self->can("pending")
!ll&&!rl&&r
1800
MC/DC0%0/3
$self->isa("Net::SSL") and $self->can("pending") and $self->pending
$self->isa("Net::SSL") $self->can("pending") $self->pending
Truth table25%1/4
A and B and C
A= $self->isa("Net::SSL")B= $self->can("pending")C= $self->pending
ABCresult
0XX0
10X0
1100
1111
311  
312 # With no timeout, wait forever. An explicit timeout of 0 can be
313 # used to just check if the socket is readable without waiting.
314 18 ▶ my $timeout = @_ ? shift : (${*$self}{io_socket_timeout} || undef);
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 18 18
Condition50%1/2
do { *$self }->{"io_socket_timeout"} or undef
l!l
180
MC/DC0%0/1
do { *$self }->{"io_socket_timeout"} or undef
do { *$self }->{"io_socket_timeout"}
Truth table50%1/2
A
A= do { *$self }->{"io_socket_timeout"}
Aresult
11
00
315  
316 18 my $fbits = '';
317 18 vec($fbits, fileno($self), 1) = 1;
318 SELECT:
319 {
320 18 my $before;
321 18 ▶ $before = time if $timeout;
Branch: 1 branch
BranchTrueFalseTotal
if $timeout 18 0 18
322 18 my $nfound = select($fbits, undef, undef, $timeout);
323 18 ▶ if ($nfound < 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nfound < 0) 0 18 18
324 0 ▶ if ($!{EINTR} || $!{EAGAIN} || $!{EWOULDBLOCK}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($!{"EINTR"} or $!{"EAGAIN"} or $!{"EWOULDBLOCK"}) 0 0 0
Condition0%0/6
$!{"EINTR"} or $!{"EAGAIN"} or $!{"EWOULDBLOCK"}
l!l&&r!l&&!r
000
$!{"EINTR"} or $!{"EAGAIN"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$!{"EINTR"} or $!{"EAGAIN"} or $!{"EWOULDBLOCK"}
$!{"EINTR"} $!{"EAGAIN"} $!{"EWOULDBLOCK"}
Truth table0%0/4
A or B or C
A= $!{"EINTR"}B= $!{"EAGAIN"}C= $!{"EWOULDBLOCK"}
ABCresult
1XX1
01X1
0011
0000
325 # don't really think EAGAIN/EWOULDBLOCK can happen here
326 0 ▶ if ($timeout) {
Branch: 1 branch
BranchTrueFalseTotal
if ($timeout) 0 0 0
327 0 $timeout -= time - $before;
328 0 ▶ $timeout = 0 if $timeout < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $timeout < 0 0 0 0
329 }
330 0 redo SELECT;
331 }
332 0 die "select failed: $!";
333 }
334 18 return $nfound > 0;
335 }
336 }
337  
338  
339 0 ▶sub _rbuf {
Subroutine _rbuf: not called CC=4 SCAR=30.0
340 0 my $self = shift;
341 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
342 0 for (${*$self}{'http_buf'}) {
343 0 my $old;
344 0 ▶ $old = $_ if defined wantarray;
Branch: 1 branch
BranchTrueFalseTotal
if defined wantarray 0 0 0
345 0 $_ = shift;
346 0 return $old;
347 }
348 }
349 else {
350 0 return ${*$self}{'http_buf'};
351 }
352 }
353  
354 0 ▶sub _rbuf_length {
Subroutine _rbuf_length: not called CC=1 SCAR=6.9
355 0 my $self = shift;
356 0 return length ${*$self}{'http_buf'};
357 }
358  
359  
360 23 ▶sub _read_header_lines {
Subroutine _read_header_lines: called CC=8 SCAR=21.6
361 23 my $self = shift;
362 23 my $junk_out = shift;
363  
364 23 my @headers;
365 23 my $line_count = 0;
366 23 my $max_header_lines = ${*$self}{'http_max_header_lines'};
367 23 ▶ while (my $line = my_readline($self, 'Header')) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $line = my_readline($self, "Header")) 92 22 114
368 92 ▶ if ($line =~ /^(\S+?)\s*:\s*(.*)/s) {
Branch: 3 branches
BranchTrueFalseTotal
if ($line =~ /^(\S+?)\s*:\s*(.*)/s) { } 90 2 92
elsif (@headers and $line =~ s/^\s+//) { } 0 2 2
elsif ($junk_out) { } 1 1 2
369 90 push(@headers, $1, $2);
370 }
371 ▶ elsif (@headers && $line =~ s/^\s+//) {
Condition33%1/3
@headers and $line =~ s/^\s+//
!ll&&!rl&&r
020
MC/DC0%0/2
@headers and $line =~ s/^\s+//
@headers $line =~ s/^\s+//
Truth table33%1/3
A and B
A= @headersB= $line =~ s/^\s+//
ABresult
0X0
100
111
372 0 $headers[-1] .= " " . $line;
373 }
374 elsif ($junk_out) {
375 1 push(@$junk_out, $line);
376 }
377 else {
378 1 die "Bad header: '$line'\n";
379 }
380 91 ▶ if ($max_header_lines) {
Branch: 1 branch
BranchTrueFalseTotal
if ($max_header_lines) 91 0 91
381 91 $line_count++;
382 91 ▶ if ($line_count >= $max_header_lines) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line_count >= $max_header_lines) 0 91 91
383 0 die "Too many header lines (limit is $max_header_lines)";
384 }
385 }
386 }
387 22 return @headers;
388 }
389  
390  
391 20 ▶sub read_response_headers {
Subroutine read_response_headers: called CC=16 SCAR=28.1
Pod undocumented
392 20 my($self, %opt) = @_;
393 20 my $laxed = $opt{laxed};
394  
395 20 my($status, $eol) = my_readline($self, 'Status');
396 20 ▶ unless (defined $status) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $status) 0 20 20
397 0 die "Server closed connection without sending any data back";
398 }
399  
400 20 my($peer_ver, $code, $message) = split(/\s+/, $status, 3);
401 20 ▶ if (!$peer_ver || $peer_ver !~ s,^HTTP/,, || $code !~ /^[1-5]\d\d$/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($peer_ver and $peer_ver =~ s[^HTTP/][] and $code =~ /^[1-5]\d\d$/) 2 18 20
Condition66%4/6
$peer_ver and $peer_ver =~ s[^HTTP/][] and $code =~ /^[1-5]\d\d$/
!ll&&!rl&&r
2018
$peer_ver and $peer_ver =~ s[^HTTP/][]
!ll&&!rl&&r
0218
MC/DC33%1/3
$peer_ver and $peer_ver =~ s[^HTTP/][] and $code =~ /^[1-5]\d\d$/
$peer_ver $peer_ver =~ s[^HTTP/][] $code =~ /^[1-5]\d\d$/
Truth table50%2/4
A and B and C
A= $peer_verB= $peer_ver =~ s[^HTTP/][]C= $code =~ /^[1-5]\d\d$/
ABCresult
0XX0
10X0
1100
1111
402 2 ▶ die "Bad response status line: '$status'" unless $laxed;
Branch: 1 branch
BranchTrueFalseTotal
unless $laxed 1 1 2
403 # assume HTTP/0.9
404 1 ${*$self}{'http_peer_http_version'} = "0.9";
405 1 ${*$self}{'http_status'} = "200";
406 1 ▶ substr(${*$self}{'http_buf'}, 0, 0) = $status . ($eol || "");
Condition50%1/2
$eol || ''
l!l
10
MC/DC0%0/1
$eol || ''
$eol
Truth table50%1/2
A
A= $eol
Aresult
11
00
407 1 ▶ return 200 unless wantarray;
Branch: 1 branch
BranchTrueFalseTotal
unless wantarray 0 1 1
408 1 return (200, "Assumed OK");
409 };
410  
411 18 ${*$self}{'http_peer_http_version'} = $peer_ver;
412 18 ${*$self}{'http_status'} = $code;
413  
414 18 my $junk_out;
415 18 ▶ if ($laxed) {
Branch: 1 branch
BranchTrueFalseTotal
if ($laxed) 1 17 18
416 1 ▶ $junk_out = $opt{junk_out} || [];
Condition50%1/2
$opt{'junk_out'} || []
l!l
01
MC/DC0%0/1
$opt{'junk_out'} || []
$opt{'junk_out'}
Truth table50%1/2
A
A= $opt{'junk_out'}
Aresult
11
00
417 }
418 18 my @headers = $self->_read_header_lines($junk_out);
419  
420 # pick out headers that read_entity_body might need
421 17 my @te;
422 my $content_length;
423 17 ▶ for (my $i = 0; $i < @headers; $i += 2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @headers) 86 17 103
424 86 my $h = lc($headers[$i]);
425 86 ▶ if ($h eq 'transfer-encoding') {
Branch: 2 branches
BranchTrueFalseTotal
if ($h eq 'transfer-encoding') { } 6 80 86
elsif ($h eq 'content-length') { } 10 70 80
426 6 my $te = $headers[$i+1];
427 6 $te =~ s/^\s+//;
428 6 $te =~ s/\s+$//;
429 6 ▶ push(@te, $te) if length($te);
Branch: 1 branch
BranchTrueFalseTotal
if length $te 6 0 6
430 }
431 elsif ($h eq 'content-length') {
432 # ignore bogus and overflow values
433 10 ▶ if ($headers[$i+1] =~ /^\s*(\d{1,15})(?:\s|$)/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($headers[$i + 1] =~ /^\s*(\d{1,15})(?:\s|$)/) 10 0 10
434 10 $content_length = $1;
435 }
436 }
437 }
438 17 ${*$self}{'http_te'} = join(",", @te);
439 17 ${*$self}{'http_content_length'} = $content_length;
440 17 ${*$self}{'http_first_body'}++;
441 17 delete ${*$self}{'http_trailers'};
442 17 ▶ return $code unless wantarray;
Branch: 1 branch
BranchTrueFalseTotal
unless wantarray 0 17 17
443 17 return ($code, $message, @headers);
444 }
445  
446  
447 999 ▶sub read_entity_body {
Subroutine read_entity_body: called CC=41 SCAR=46.4
Pod undocumented
448 999 my $self = shift;
449 999 my $buf_ref = \$_[0];
450 999 my $size = $_[1];
451 999 ▶ die "Offset not supported yet" if $_[2];
Branch: 1 branch
BranchTrueFalseTotal
if $_[2] 0 999 999
452  
453 999 my $chunked;
454 my $bytes;
455  
456 999 ▶ if (${*$self}{'http_first_body'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { *$self }->{'http_first_body'}) { } 17 982 999
457 17 ${*$self}{'http_first_body'} = 0;
458 17 delete ${*$self}{'http_chunked'};
459 17 delete ${*$self}{'http_bytes'};
460 17 my $method = shift(@{${*$self}{'http_request_method'}});
461 17 my $status = ${*$self}{'http_status'};
462 17 ▶ if ($method eq "HEAD") {
Branch: 4 branches
BranchTrueFalseTotal
if ($method eq 'HEAD') { } 1 16 17
elsif (my $te = do { *$self }->{'http_te'}) { } 5 11 16
elsif (defined(my $content_length = do { *$self }->{'http_content_length'})) { } 9 2 11
elsif ($status =~ /^(?:1|[23]04)/) { } 0 2 2
463 # this response is always empty regardless of other headers
464 1 $bytes = 0;
465 }
466 16 elsif (my $te = ${*$self}{'http_te'}) {
467 5 my @te = split(/\s*,\s*/, lc($te));
468 5 ▶ die "Chunked must be last Transfer-Encoding '$te'"
Branch: 1 branch
BranchTrueFalseTotal
unless pop @te eq "chunked" 0 5 5
469 unless pop(@te) eq "chunked";
470 5 ▶ pop(@te) while @te && $te[-1] eq "chunked"; # ignore repeated chunked spec
Branch: 1 branch
BranchTrueFalseTotal
@te and $te[-1] eq "chunked" and do { pop @te } 1 5 6
Condition66%2/3
@te and $te[-1] eq "chunked"
!ll&&!rl&&r
501
MC/DC50%1/2
@te and $te[-1] eq "chunked"
@te $te[-1] eq "chunked"
Truth table66%2/3
A and B
A= @teB= $te[-1] eq "chunked"
ABresult
0X0
100
111
471  
472 5 for (@te) {
473 0 ▶ if ($_ eq "deflate" && inflate_ok()) {
Branch: 3 branches
BranchTrueFalseTotal
if ($_ eq 'deflate' and inflate_ok()) { } 0 0 0
elsif ($_ eq 'gzip' and gunzip_ok()) { } 0 0 0
elsif ($_ eq 'identity') { } 0 0 0
Condition0%0/3
$_ eq "deflate" and inflate_ok()
!ll&&!rl&&r
000
MC/DC0%0/2
$_ eq "deflate" and inflate_ok()
$_ eq "deflate" inflate_ok()
Truth table0%0/3
A and B
A= $_ eq "deflate"B= inflate_ok()
ABresult
0X0
100
111
474 #require Compress::Raw::Zlib;
475 0 my ($i, $status) = Compress::Raw::Zlib::Inflate->new();
476 0 ▶ die "Can't make inflator: $status" unless $i;
Branch: 1 branch
BranchTrueFalseTotal
unless $i 0 0 0
477 0 ▶ $_ = sub { my $out; $i->inflate($_[0], \$out); $out }
Subroutine __ANON__: not called CC=1 SCAR=6.9
478 0 }
479 ▶ elsif ($_ eq "gzip" && gunzip_ok()) {
Condition0%0/3
$_ eq "gzip" and gunzip_ok()
!ll&&!rl&&r
000
MC/DC0%0/2
$_ eq "gzip" and gunzip_ok()
$_ eq "gzip" gunzip_ok()
Truth table0%0/3
A and B
A= $_ eq "gzip"B= gunzip_ok()
ABresult
0X0
100
111
480 #require IO::Uncompress::Gunzip;
481 0 my @buf;
482 0 ▶ $_ = sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
483 0 push(@buf, $_[0]);
484 0 ▶ return "" unless $_[1];
Branch: 1 branch
BranchTrueFalseTotal
unless $_[1] 0 0 0
485 0 my $input = join("", @buf);
486 0 my $output;
487 0 ▶ IO::Uncompress::Gunzip::gunzip(\$input, \$output, Transparent => 0)
Branch: 1 branch
BranchTrueFalseTotal
IO::Uncompress::Gunzip::gunzip(\$input, \$output, "Transparent", 0) or die "Can't gunzip content: $IO::Uncompress::Gunzip::GunzipError" 0 0 0
488 or die "Can't gunzip content: $IO::Uncompress::Gunzip::GunzipError";
489 0 return \$output;
490 0 };
491 }
492 elsif ($_ eq "identity") {
493 0 ▶ $_ = sub { $_[0] };
Subroutine __ANON__: not called CC=1 SCAR=6.9
494 }
495 else {
496 0 die "Can't handle transfer encoding '$te'";
497 }
498 }
499  
500 5 @te = reverse(@te);
501  
502 5 ▶ ${*$self}{'http_te2'} = @te ? \@te : "";
Branch: 1 branch
BranchTrueFalseTotal
@te ? : 0 5 5
503 5 $chunked = -1;
504 }
505 11 elsif (defined(my $content_length = ${*$self}{'http_content_length'})) {
506 9 $bytes = $content_length;
507 }
508 elsif ($status =~ /^(?:1|[23]04)/) {
509 # RFC 2616 says that these responses should always be empty
510 # but that does not appear to be true in practice [RT#17907]
511 0 $bytes = 0;
512 }
513 else {
514 # XXX Multi-Part types are self delimiting, but RFC 2616 says we
515 # only has to deal with 'multipart/byteranges'
516  
517 # Read until EOF
518 }
519 }
520 else {
521 982 $chunked = ${*$self}{'http_chunked'};
522 982 $bytes = ${*$self}{'http_bytes'};
523 }
524  
525 999 ▶ if (defined $chunked) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $chunked) { } 78 921 999
elsif (defined $bytes) { } 916 5 921
526 # The state encoded in $chunked is:
527 # $chunked == 0: read CRLF after chunk, then chunk header
528 # $chunked == -1: read chunk header
529 # $chunked > 0: bytes left in current chunk to read
530  
531 78 ▶ if ($chunked <= 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chunked <= 0) 16 62 78
532 16 my $line = my_readline($self, 'Entity body');
533 16 ▶ if ($chunked == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chunked == 0) 11 5 16
534 11 ▶ die "Missing newline after chunk data: '$line'"
Branch: 1 branch
BranchTrueFalseTotal
if not defined $line or $line ne "" 0 11 11
Condition33%1/3
not defined $line or $line ne ""
l!l&&r!l&&!r
0011
MC/DC0%0/2
not defined $line or $line ne ""
not defined $line $line ne ""
Truth table33%1/3
not(A) or B
A= not defined $lineB= $line ne ""
ABresult
1X1
011
000
535 if !defined($line) || $line ne "";
536 11 $line = my_readline($self, 'Entity body');
537 }
538 16 ▶ die "EOF when chunk header expected" unless defined($line);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $line 0 16 16
539 16 my $chunk_len = $line;
540 16 $chunk_len =~ s/;.*//; # ignore potential chunk parameters
541 16 ▶ unless ($chunk_len =~ /^([\da-fA-F]+)\s*$/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($chunk_len =~ /^([\da-fA-F]+)\s*$/) 0 16 16
542 0 die "Bad chunk-size in HTTP response: $line";
543 }
544 16 $chunked = hex($1);
545 16 ${*$self}{'http_chunked'} = $chunked;
546 16 ▶ if ($chunked == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chunked == 0) 5 11 16
547 5 ${*$self}{'http_trailers'} = [$self->_read_header_lines];
548 5 $$buf_ref = "";
549  
550 5 my $n = 0;
551 5 ▶ if (my $transforms = delete ${*$self}{'http_te2'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $transforms = delete do { *$self }->{"http_te2"}) 0 5 5
552 0 for (@$transforms) {
553 0 $$buf_ref = &$_($$buf_ref, 1);
554 }
555 0 $n = length($$buf_ref);
556 }
557  
558 # in case somebody tries to read more, make sure we continue
559 # to return EOF
560 5 delete ${*$self}{'http_chunked'};
561 5 ${*$self}{'http_bytes'} = 0;
562  
563 5 return $n;
564 }
565 }
566  
567 73 my $n = $chunked;
568 73 ▶ $n = $size if $size && $size < $n;
Branch: 1 branch
BranchTrueFalseTotal
if $size and $size < $n 56 17 73
Condition66%2/3
$size and $size < $n
!ll&&!rl&&r
01756
MC/DC50%1/2
$size and $size < $n
$size $size < $n
Truth table66%2/3
A and B
A= $sizeB= $size < $n
ABresult
0X0
100
111
569 73 $n = my_read($self, $$buf_ref, $n);
570 73 ▶ return undef unless defined $n;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $n 0 73 73
571  
572 73 ${*$self}{'http_chunked'} = $chunked - $n;
573  
574 73 ▶ if ($n > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n > 0) 73 0 73
575 73 ▶ if (my $transforms = ${*$self}{'http_te2'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $transforms = do { *$self }->{"http_te2"}) 0 73 73
576 0 for (@$transforms) {
577 0 $$buf_ref = &$_($$buf_ref, 0);
578 }
579 0 $n = length($$buf_ref);
580 0 ▶ $n = -1 if $n == 0;
Branch: 1 branch
BranchTrueFalseTotal
if $n == 0 0 0 0
581 }
582 }
583 73 return $n;
584 }
585 elsif (defined $bytes) {
586 916 ▶ unless ($bytes) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($bytes) 10 906 916
587 10 $$buf_ref = "";
588 10 return 0;
589 }
590 906 my $n = $bytes;
591 906 ▶ $n = $size if $size && $size < $n;
Branch: 1 branch
BranchTrueFalseTotal
if $size and $size < $n 891 15 906
Condition66%2/3
$size and $size < $n
!ll&&!rl&&r
015891
MC/DC50%1/2
$size and $size < $n
$size $size < $n
Truth table66%2/3
A and B
A= $sizeB= $size < $n
ABresult
0X0
100
111
592 906 $n = my_read($self, $$buf_ref, $n);
593 906 ▶ ${*$self}{'http_bytes'} = defined $n ? $bytes - $n : $bytes;
Branch: 1 branch
BranchTrueFalseTotal
defined $n ? : 905 1 906
594 906 return $n;
595 }
596 else {
597 # read until eof
598 5 ▶ $size ||= 8*1024;
Condition50%1/2
$size ||= 8192
l!l
50
MC/DC0%0/1
$size ||= 8192
$size
Truth table50%1/2
A
A= $size
Aresult
11
00
599 5 return my_read($self, $$buf_ref, $size);
600 }
601 }
602  
603 13 ▶sub get_trailers {
Subroutine get_trailers: called CC=2 SCAR=6.9
Pod undocumented
604 13 my $self = shift;
605 13 ▶ @{${*$self}{'http_trailers'} || []};
Condition100%2/2
do { *$self }->{'http_trailers'} || []
l!l
310
MC/DC100%1/1
do { *$self }->{'http_trailers'} || []
do { *$self }->{'http_trailers'}
Truth table100%2/2
A
A= do { *$self }->{'http_trailers'}
Aresult
11
00
606 }
607  
608 5 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
609 5 my $gunzip_ok;
610 5 my $inflate_ok;
611  
612 0 ▶sub gunzip_ok {
Subroutine gunzip_ok: not called CC=2 SCAR=17.9
Pod undocumented
613 0 ▶ return $gunzip_ok if defined $gunzip_ok;
Branch: 1 branch
BranchTrueFalseTotal
if defined $gunzip_ok 0 0 0
614  
615 # Try to load IO::Uncompress::Gunzip.
616 0 local $@;
617 0 local $SIG{__DIE__};
618 0 $gunzip_ok = 0;
619  
620 0 eval {
621 0 require IO::Uncompress::Gunzip;
622 0 $gunzip_ok++;
623 };
624  
625 0 return $gunzip_ok;
626 }
627  
628 0 ▶sub inflate_ok {
Subroutine inflate_ok: not called CC=2 SCAR=17.9
Pod undocumented
629 0 ▶ return $inflate_ok if defined $inflate_ok;
Branch: 1 branch
BranchTrueFalseTotal
if defined $inflate_ok 0 0 0
630  
631 # Try to load Compress::Raw::Zlib.
632 0 local $@;
633 0 local $SIG{__DIE__};
634 0 $inflate_ok = 0;
635  
636 0 eval {
637 0 require Compress::Raw::Zlib;
638 0 $inflate_ok++;
639 };
640  
641 0 return $inflate_ok;
642 }
643  
644 } # BEGIN
645  
646 5 1;
647  
648 =pod
649  
650 =encoding UTF-8
651  
652 =head1 NAME
653  
654 Net::HTTP::Methods - Methods shared by Net::HTTP and Net::HTTPS
655  
656 =head1 VERSION
657  
658 version 6.24
659  
660 =head1 AUTHOR
661  
662 Gisle Aas <gisle@activestate.com>
663  
664 =head1 COPYRIGHT AND LICENSE
665  
666 This software is copyright (c) 2001 by Gisle Aas.
667  
668 This is free software; you can redistribute it and/or modify it under
669 the same terms as the Perl 5 programming language system itself.
670  
671 =cut
672  
673 __END__
↑ Summary HTTPS.pm »