Branch Coverage

blib/lib/HTTP/Cookies.pm
Criterion Covered Total %
branch 178 218 81.6


line true false branch
40 3 67 unless ($scheme =~ /^https?\z/)
45 4 63 unless $domain =~ /\./
50 3 64 if $req_path =~ /%/
59 195 57 unless $cookies
60 0 57 if ($self->{'delayload'} and defined $cookies->{'//+delayload'})
65 0 0 unless $cookies
72 7 60 if (index($req_path, $path) != 0)
79 1 74 if ($secure and not $secure_request)
82 0 74 if ($expires and $expires < $now)
85 7 67 if ($port)
87 4 3 if ($port =~ s/^_//) { }
89 4 0 if $port eq $req_port
95 3 4 if $p eq $req_port
98 0 7 unless ($found)
102 0 74 if ($version > 0 and $netscape_only)
109 50 24 unless ($set_ver++)
110 18 32 if ($version >= 1) { }
32 0 elsif (not $self->{'hide_cookie2'}) { }
119 0 74 if ($val =~ /\W/ and $version)
126 31 43 if ($version >= 1)
127 16 15 if $path_spec
128 8 23 if $domain =~ /^\./
129 7 24 if (defined $port)
131 3 4 if length $port
150 126 126 if ($domain =~ s/^\.+//) { }
159 50 17 if (@cval)
160 2 48 if (my $old = $request->header('Cookie'))
164 8 42 if (my $hash = $request->{'_http_cookies'})
177 6 3 unless $url =~ /^[a-zA-Z][a-zA-Z0-9.+\-]*:/
182 8 1 if (@_)
183 1 7 if wantarray
198 7 63 unless @set or @ns_set
203 3 60 unless $req_host =~ /\./
206 2 61 if $req_path =~ /%/
208 33 30 if (@ns_set)
231 1 107 unless length $param
233 105 2 if (defined $v) { }
241 14 93 if (not $first_param and lc $k eq 'expires') { }
1 92 elsif (not $first_param and lc $k eq 'max-age') { }
2 90 elsif (not $first_param and lc($k) =~ /^(?:version|discard|ns-cookie)/) { }
243 12 2 if (defined $etime) { }
250 2 0 if ($year)
252 2 0 if ($year < $thisyear) { }
0 0 elsif ($year >= $thisyear + 10) { }
276 1 42 unless @cur
277 1 41 if $in_set2{$cur[0]}
280 26 15 unless $expires
289 0 77 unless @$set >= 2
300 192 44 if $lc =~ /^(?:discard|domain|max-age| path|port|secure|version)$/x
302 33 203 if ($k eq 'discard' or $k eq 'secure')
303 33 0 unless defined $v
305 0 236 if exists $hash{$k}
311 16 61 unless defined $version
319 25 52 if defined $domain
320 17 60 if (defined $domain and $domain ne $req_host and $domain ne ".$req_host") { }
322 0 17 if (not $domain =~ /\./ and $domain ne 'local')
325 3 14 unless $domain =~ /^\./
326 1 16 if ($domain =~ /\.\d+$/)
330 0 16 unless (substr($req_host, -$len) eq $domain)
334 2 14 if ($hostpre =~ /\./ and not $ns_cookie)
344 49 25 if (defined $path and $path ne '') { }
346 1 48 if $path =~ /%/
347 4 45 if (not $ns_cookie and substr($req_path, 0, length $path) ne $path)
355 24 1 unless length $path
359 5 65 if (exists $hash{'port'})
361 3 2 if (defined $port) { }
365 0 7 unless ($p =~ /^\d+$/)
368 2 5 if $p eq $req_port
370 1 2 unless ($found)
378 69 0 if $self->set_cookie_ok(\%orig_hash)
399 0 78 if not defined $path && $path =~ m[^/] && defined $key or $key =~ /^\$/
403 4 74 if (defined $port)
404 0 4 unless $port =~ /^_?\d+(?:,\d+)*$/
408 27 51 if (defined $maxage)
409 8 19 if ($maxage <= 0)
415 6 64 unless defined $version
420 3 67 if defined $rest and %$rest
434 1 1 @_ == 1 ? :
437 0 2 if keys %args > 2
439 0 2 unless open my $fh, '>', $file
442 0 2 unless close $fh
453 0 2 unless open my $fh, '<', $file
458 0 2 unless ($magic =~ /^#LWP-Cookies-\d+\.\d+/)
466 0 7 unless $line =~ s/^Set-Cookie3:\s*//
488 1 6 if %hash
507 5 0 if (@_ == 0) { }
0 0 elsif (@_ == 1) { }
0 0 elsif (@_ == 2) { }
0 0 elsif (@_ == 3) { }
532 3 3 if ($_[9] or not $_[8])
545 0 29 if $self->{'autosave'}
559 126 8 unless defined $rest
575 0 49 if $discard and $skip_discard
579 7 42 if defined $port
580 24 25 if $path_spec
581 0 49 if $secure
582 10 39 if $expires
583 18 31 if $discard
597 32 98 if (my $h = $request->header('Host'))
608 0 130 if ($url->can('epath')) { }
614 37 93 unless length $path
623 9 26 $x eq '2F' || $x eq '25' ? :
640 18 188 if ($in_string) { }
641 2 16 if ($chunk eq '\\') { }
4 12 elsif ($chunk eq '"') { }
646 2 0 if ($i < @vals)
656 4 184 if ($chunk eq '"') { }
72 112 elsif ($chunk eq ';') { }
668 42 3 if @current_string