line |
true |
false |
branch |
110
|
1 |
38 |
unless (defined $class)
|
128
|
20 |
18 |
if ($ENV{'SERVER_PROTOCOL'} and $ENV{'SERVER_PROTOCOL'} eq 'HTTP/1.1' || $ENV{'SERVER_PROTOCOL'} eq 'HTTP/2.0') { }
|
139
|
37 |
0 |
if (defined $^V and $^V ge "v5.14.0")
|
140
|
0 |
37 |
if ${^GLOBAL_PHASE} eq "DESTRUCT"
|
144
|
1 |
36 |
if ($self->{'logger'})
|
148
|
0 |
37 |
unless (defined $self->{'buf'} and defined $self->{'buf'}->getpos)
|
150
|
0 |
0 |
if ($self->{'logger'})
|
162
|
1 |
36 |
if ($self->{'logger'})
|
163
|
0 |
1 |
if ($ENV{'HTTP_IF_NONE_MATCH'})
|
166
|
0 |
1 |
if ($ENV{'HTTP_IF_MODIFIED_SINCE'})
|
173
|
3 |
34 |
unless ($headers or $self->is_cached)
|
174
|
0 |
3 |
if ($self->{'logger'})
|
179
|
1 |
33 |
if ($ENV{'REQUEST_METHOD'} and $ENV{'REQUEST_METHOD'} eq 'HEAD') { }
|
185
|
34 |
0 |
if ($headers)
|
189
|
2 |
32 |
if (defined $self->{'body'} and $self->{'body'} eq '') { }
|
|
29 |
3 |
elsif (defined $self->{'content_type'}) { }
|
193
|
0 |
2 |
if ($self->{'cache'})
|
199
|
29 |
0 |
if (defined $content_type[0] and lc $content_type[0] eq "text" and lc($content_type[1]) =~ /^html/ and defined $self->{'body'})
|
200
|
25 |
4 |
if ($self->{'optimise_content'})
|
204
|
0 |
25 |
if ($self->{'logger'})
|
211
|
24 |
1 |
if ($self->{'optimise_content'} == 1) { }
|
217
|
1 |
2 |
if $newlength >= $oldlength
|
226
|
22 |
3 |
unless (defined $self->{'info'})
|
227
|
0 |
22 |
if ($self->{'cache'}) { }
|
237
|
10 |
15 |
unless ($protocol)
|
248
|
18 |
7 |
if (my $script_name = $ENV{'SCRIPT_NAME'})
|
249
|
18 |
0 |
if ($script_name =~ m[^/])
|
275
|
1 |
24 |
if ($self->{'optimise_content'} >= 2)
|
282
|
1 |
24 |
if ($self->{'optimise_content'} >= 2)
|
288
|
1 |
0 |
if $newlength >= $oldlength
|
293
|
3 |
26 |
if ($self->{'lint_content'})
|
297
|
0 |
3 |
if ($self->{'logger'})
|
304
|
1 |
2 |
if ($lint->errors)
|
318
|
1 |
33 |
if (defined $headers and $headers =~ /^Status: (\d+)/m) { }
|
|
25 |
8 |
elsif (defined $self->{'info'}) { }
|
326
|
1 |
33 |
if ($self->{'logger'})
|
333
|
11 |
8 |
if ($ENV{'SERVER_PROTOCOL'} and $ENV{'SERVER_PROTOCOL'} eq 'HTTP/1.1' || $ENV{'SERVER_PROTOCOL'} eq 'HTTP/2.0' and $self->{'generate_etag'} and defined $self->{'body'})
|
338
|
2 |
2 |
if ($ENV{'HTTP_IF_NONE_MATCH'} and $self->{'generate_304'} and $self->{'status'} == 200)
|
344
|
0 |
34 |
if (my $save_to = $self->{'save_to'})
|
346
|
0 |
0 |
if ($self->{'logger'})
|
349
|
0 |
0 |
if (not -r $sqlite_file) { }
|
350
|
0 |
0 |
unless (-d $save_to->{'directory'})
|
354
|
0 |
0 |
if ($self->{'save_to'}{'create_table'})
|
365
|
32 |
2 |
if (defined $unzipped_body)
|
366
|
0 |
32 |
$ENV{'Range'} ? :
|
368
|
3 |
29 |
if ($range and not $self->{'cache'})
|
370
|
3 |
0 |
if ($range =~ /^bytes=(\d*)-(\d*)/)
|
371
|
1 |
2 |
if ($1 and $2) { }
|
|
1 |
1 |
elsif ($1) { }
|
|
1 |
0 |
elsif ($2) { }
|
385
|
0 |
34 |
if ($self->{'cache'}) { }
|
|
26 |
8 |
elsif ($self->{'info'}) { }
|
392
|
0 |
0 |
if (not defined $self->{'body'}) { }
|
393
|
0 |
0 |
if ($self->{'send_body'})
|
395
|
0 |
0 |
if (defined $self->{'cobject'}) { }
|
400
|
0 |
0 |
if ($self->{'info'}) { }
|
415
|
0 |
0 |
if ($self->{'send_body'} and $ENV{'SERVER_PROTOCOL'} and $ENV{'SERVER_PROTOCOL'} eq 'HTTP/1.1' || $ENV{'SERVER_PROTOCOL'} eq 'HTTP/2.0' and $self->{'generate_304'} and $self->{'status'} == 200)
|
418
|
0 |
0 |
if ($ENV{'HTTP_IF_MODIFIED_SINCE'})
|
425
|
0 |
0 |
if ($self->{'send_body'} and $self->{'status'} == 200)
|
427
|
0 |
0 |
if ($dbh)
|
429
|
0 |
0 |
if ($changes and my $ttl = $self->{'save_to'}{'ttl'})
|
433
|
0 |
0 |
unless (defined $self->{'body'})
|
442
|
0 |
0 |
if ($dbh)
|
445
|
0 |
0 |
if ($self->{'logger'})
|
448
|
0 |
0 |
if ($sth->execute and my $href = $sth->fetchrow_hashref)
|
449
|
0 |
0 |
if (my $path = $href->{'path'})
|
455
|
0 |
0 |
if ($self->{'logger'})
|
462
|
0 |
0 |
if ($self->{'logger'}) { }
|
472
|
0 |
0 |
if ($self->{'send_body'} and $ENV{'SERVER_PROTOCOL'} and $ENV{'SERVER_PROTOCOL'} eq 'HTTP/1.1' || $ENV{'SERVER_PROTOCOL'} eq 'HTTP/2.0' and $self->{'status'} == 200)
|
475
|
0 |
0 |
if ($ENV{'HTTP_IF_NONE_MATCH'} and $self->{'generate_etag'})
|
476
|
0 |
0 |
unless (defined $self->{'etag'})
|
482
|
0 |
0 |
if ($self->{'status'} == 200)
|
484
|
0 |
0 |
if ($self->{'send_body'})
|
485
|
0 |
0 |
if ($self->{'generate_etag'} and not defined $self->{'etag'} and not defined $headers && $headers =~ /^ETag: /m)
|
492
|
0 |
0 |
unless ($self->{'etag'})
|
493
|
0 |
0 |
if (defined $headers and $headers =~ /^ETag: "([a-z0-9]{32})"/m) { }
|
499
|
0 |
0 |
if ($ENV{'HTTP_IF_NONE_MATCH'} and $self->{'send_body'} and $self->{'status'} != 304 and $self->{'generate_304'})
|
500
|
0 |
0 |
unless ($self->_check_if_none_match)
|
504
|
0 |
0 |
if ($self->{'cobject'})
|
505
|
0 |
0 |
if ($ENV{'HTTP_IF_MODIFIED_SINCE'} and $self->{'status'} != 304 and not $cannot_304)
|
511
|
0 |
0 |
if ($self->{'status'} == 200 and $self->{'generate_last_modified'})
|
512
|
0 |
0 |
if ($self->{'logger'})
|
520
|
0 |
0 |
if ($self->{'status'} == 200)
|
523
|
0 |
0 |
unless ($self->{'cache_age'})
|
530
|
0 |
0 |
if ($changes and $encoding)
|
533
|
0 |
0 |
if ($self->{'o'} and scalar @{$self->{'o'};}) { }
|
|
0 |
0 |
elsif (defined $headers and length $headers) { }
|
537
|
0 |
0 |
if (defined $headers and length $headers) { }
|
545
|
0 |
0 |
if (length $c)
|
552
|
0 |
0 |
if (length $headers)
|
556
|
0 |
0 |
if ($self->{'generate_etag'})
|
557
|
0 |
0 |
unless (defined $self->{'etag'})
|
565
|
0 |
0 |
if ($self->{'logger'})
|
572
|
0 |
0 |
if ($dbh and $self->{'info'} and $self->{'save_to'} and my $request_uri = $ENV{'REQUEST_URI'})
|
574
|
0 |
0 |
if ($self->{'logger'})
|
579
|
0 |
0 |
if (my $href = $sth->fetchrow_hashref) { }
|
580
|
0 |
0 |
if (my $ttl = $self->{'save_to'}{'ttl'})
|
588
|
0 |
0 |
if ($self->{'lingua'}) { }
|
590
|
0 |
0 |
if ($language =~ /([\w\s]+)/i)
|
597
|
0 |
0 |
if ($bdir =~ m(^([/\\])(.+)$))
|
602
|
0 |
0 |
if ($self->{'logger'})
|
609
|
0 |
0 |
if ($path =~ /^(.+)$/)
|
613
|
0 |
0 |
if (open my $fout, '>', $path) { }
|
625
|
0 |
0 |
unless ($self->{'_encode_loaded'})
|
634
|
0 |
0 |
if ($self->{'logger'})
|
639
|
0 |
0 |
if ($changes and my $ttl = $self->{'save_to'}{'ttl'})
|
643
|
0 |
0 |
if ($self->{'logger'})
|
649
|
0 |
0 |
if ($self->{'generate_last_modified'})
|
651
|
0 |
0 |
if (defined $self->{'cobject'}) { }
|
658
|
0 |
0 |
if ($self->{'info'}) { }
|
660
|
0 |
0 |
if (defined $self->{'x_cache'}) { }
|
667
|
0 |
0 |
if (defined $self->{'x_cache'}) { }
|
682
|
26 |
0 |
if ($self->{'generate_last_modified'})
|
683
|
8 |
18 |
if (my $age = $self->_my_age)
|
687
|
3 |
0 |
if ($ENV{'HTTP_IF_MODIFIED_SINCE'} and $self->{'status'} != 304 and $self->{'generate_304'})
|
693
|
0 |
26 |
if ($self->_save_to($unzipped_body, $dbh) and $encoding)
|
733
|
11 |
23 |
if ($self->{'generate_etag'} and not defined $headers && $headers =~ /^ETag: /m)
|
734
|
11 |
0 |
if (defined $self->{'etag'}) { }
|
|
0 |
0 |
elsif ($self->{'logger'} and $self->{'status'} == 200 || $self->{'status'} == 304 and $self->{'body'} and not $ENV{'NO_CACHE'} and not $self->is_cached) { }
|
736
|
0 |
11 |
if ($self->{'logger'})
|
759
|
32 |
2 |
if (defined $self->{'body'}) { }
|
760
|
1 |
31 |
if (utf8::is_utf8($self->{'body'}))
|
768
|
34 |
0 |
if (defined $headers and length $headers) { }
|
772
|
30 |
2 |
if ($self->{'body'} and $self->{'send_body'})
|
773
|
30 |
0 |
unless (grep /^Content-Length: \d/, @{$$self{"o"};})
|
777
|
31 |
3 |
unless (grep /^Status: \d/, @{$$self{"o"};})
|
787
|
30 |
2 |
if ($body_length and $self->{'send_body'})
|
792
|
34 |
0 |
if (do {
|
799
|
0 |
0 |
if ($self->{'logger'})
|
828
|
4 |
30 |
if (not $self->{'send_body'} && defined $self->{'body'})
|
836
|
0 |
11 |
if defined $self->{'etag'}
|
838
|
11 |
0 |
unless (defined $self->{'_encode_loaded'})
|
844
|
0 |
11 |
if ($self->{'logger'})
|
852
|
0 |
3 |
if ($self->{'logger'})
|
856
|
0 |
3 |
unless ($self->{'generate_304'})
|
861
|
0 |
3 |
unless (defined $params->{'since'})
|
865
|
1 |
2 |
unless (defined $s)
|
866
|
0 |
1 |
if ($self->{'logger'})
|
873
|
2 |
0 |
unless (defined $age)
|
874
|
0 |
2 |
if ($self->{'logger'})
|
879
|
0 |
0 |
if ($age > $s)
|
880
|
0 |
0 |
if ($self->{'logger'})
|
887
|
0 |
0 |
if ($self->{'logger'})
|
890
|
0 |
0 |
if ($params->{'modified'} <= $s)
|
894
|
0 |
0 |
if ($self->{'logger'})
|
960
|
0 |
0 |
if ($self->{'cache_key'})
|
963
|
0 |
0 |
unless (defined $self->{'info'})
|
969
|
0 |
0 |
if ($self->{'lingua'})
|
972
|
0 |
0 |
if ($ENV{'HTTP_COOKIE'})
|
977
|
0 |
0 |
unless ($cookie =~ /^__utm[abcz]/)
|
985
|
0 |
0 |
if ($headers and $headers =~ /^Vary: .*$/m)
|
986
|
0 |
0 |
if (defined $self->{'logger'})
|
991
|
0 |
0 |
if (lc $h1_name eq "vary")
|
994
|
0 |
0 |
if ($h2_name eq $h1_value)
|
1005
|
0 |
0 |
if (defined $self->{'logger'})
|
1094
|
22 |
10 |
ref $_[0] eq 'HASH' ? :
|
1097
|
9 |
23 |
if (defined $params{'generate_etag'})
|
1100
|
0 |
32 |
if (defined $params{'generate_last_modified'})
|
1103
|
1 |
31 |
if (defined $params{'compress_content'})
|
1106
|
31 |
1 |
if (defined $params{'optimise_content'})
|
1109
|
4 |
28 |
if (defined $params{'lint_content'})
|
1112
|
1 |
31 |
if (defined $params{'logger'})
|
1115
|
0 |
32 |
if (defined $params{'lingua'})
|
1119
|
1 |
31 |
if (defined $params{'save_to'} and $self->can_cache) { }
|
|
0 |
62 |
elsif (exists $params{'save_to'} and not defined $params{'save_to'}) { }
|
1120
|
1 |
0 |
if (my $dir = $params{'save_to'}{'directory'})
|
1121
|
1 |
0 |
unless (-d $dir)
|
1123
|
1 |
0 |
unless (-d $dir)
|
1128
|
0 |
0 |
unless (-w $dir)
|
1134
|
0 |
0 |
unless (exists $params{'save_to'}{'ttl'})
|
1140
|
3 |
28 |
if (defined $params{'generate_304'})
|
1143
|
4 |
27 |
if (defined $params{'info'} and not defined $self->{'info'})
|
1149
|
0 |
31 |
if ($pos > 0)
|
1150
|
0 |
0 |
if (defined $self->{'logger'}) { }
|
1158
|
0 |
31 |
if (exists $params{'cache'} and $self->can_cache)
|
1159
|
0 |
0 |
if (defined $ENV{'HTTP_CACHE_CONTROL'})
|
1161
|
0 |
0 |
if (defined $self->{'logger'})
|
1164
|
0 |
0 |
if ($control =~ /^max-age\s*=\s*(\d+)$/)
|
1168
|
0 |
0 |
if (defined $self->{'logger'})
|
1174
|
0 |
0 |
if (not defined $params{'cache'} and defined $self->{'cache'}) { }
|
1175
|
0 |
0 |
if (defined $self->{'logger'})
|
1176
|
0 |
0 |
if ($self->{'cache_key'}) { }
|
1186
|
0 |
0 |
if (defined $params{'cache_key'})
|
1198
|
11 |
0 |
unless scalar @_
|
1211
|
8 |
3 |
ref $_[0] eq 'HASH' ? :
|
1226
|
1 |
8 |
if (defined $self->{'x_cache'})
|
1229
|
0 |
8 |
if (defined $ENV{'NO_CACHE'} or defined $ENV{'NO_STORE'})
|
1233
|
0 |
8 |
if (defined $ENV{'HTTP_CACHE_CONTROL'})
|
1235
|
0 |
0 |
if (defined $self->{'logger'})
|
1239
|
0 |
0 |
if ($control eq "no-store" or $control eq "no-cache" or $control eq "max-age=0" or $control eq "private")
|
1293
|
12 |
0 |
unless ($self->{'cache'})
|
1294
|
0 |
12 |
if ($self->{'logger'})
|
1306
|
0 |
0 |
if ($self->{'logger'})
|
1310
|
0 |
0 |
unless ($self->{'cobject'})
|
1311
|
0 |
0 |
if ($self->{'logger'})
|
1316
|
0 |
0 |
unless ($self->{'cobject'}->value($key))
|
1317
|
0 |
0 |
if ($self->{'logger'})
|
1327
|
0 |
0 |
unless (defined $age)
|
1328
|
0 |
0 |
if ($self->{'logger'})
|
1336
|
0 |
0 |
if ($age > $self->{'cobject'}->created_at)
|
1338
|
0 |
0 |
if ($self->{'logger'})
|
1348
|
0 |
0 |
if ($self->{'logger'})
|
1357
|
0 |
31 |
if ($self->{'script_mtime'})
|
1360
|
0 |
31 |
unless (defined $self->{'info'})
|
1361
|
0 |
0 |
if ($self->{'cache'}) { }
|
1369
|
0 |
31 |
unless (defined $path)
|
1381
|
2 |
31 |
if ($self->{'compress_content'} and $ENV{'HTTP_ACCEPT_ENCODING'} || $ENV{'HTTP_TE'})
|
1382
|
2 |
0 |
if (defined $self->{'content_type'})
|
1384
|
0 |
2 |
if ($content_type[0] ne "text")
|
1388
|
1 |
1 |
$ENV{'HTTP_ACCEPT_ENCODING'} ? :
|
1390
|
1 |
0 |
if ($method eq "gzip" or $method eq "x-gzip" or $method eq "br")
|
1405
|
31 |
3 |
if (lc $header_name eq "content-type")
|
1416
|
32 |
0 |
ref $_[0] eq 'HASH' ? :
|
1420
|
30 |
2 |
if (length $encoding == 0 or length $self->{'body'} < 32)
|
1424
|
1 |
1 |
if ($encoding eq 'gzip') { }
|
|
1 |
0 |
elsif ($encoding eq 'br') { }
|
1429
|
1 |
0 |
unless ($self->{'_encode_loaded'})
|
1434
|
0 |
1 |
if (length $nbody < length $self->{'body'})
|
1436
|
0 |
0 |
unless (grep /^Content-Encoding: gzip/, @{$$self{"o"};})
|
1439
|
0 |
0 |
unless (grep /^Vary: Accept-Encoding/, @{$$self{"o"};})
|
1447
|
0 |
1 |
unless ($self->{'_encode_loaded'})
|
1452
|
1 |
0 |
if (length $nbody < length $self->{'body'})
|
1454
|
1 |
0 |
unless (grep /^Content-Encoding: br/, @{$$self{"o"};})
|
1457
|
1 |
0 |
unless (grep /^Vary: Accept-Encoding/, @{$$self{"o"};})
|
1467
|
0 |
2 |
if ($self->{'logger'})
|
1470
|
2 |
0 |
if ($ENV{'HTTP_IF_NONE_MATCH'} eq $self->{'etag'})
|
1474
|
0 |
2 |
if ($self->{'logger'})
|
1479
|
0 |
0 |
if ($self->{'cache'} and $self->{'logger'} and $self->{'logger'}->is_debug)
|
1482
|
0 |
0 |
if ($cached_copy and $self->{'body'}) { }
|
1500
|
0 |
0 |
unless $dbh and $self->{'info'} and my $request_uri = $ENV{'REQUEST_URI'}
|
1501
|
0 |
0 |
unless defined $unzipped_body
|
1510
|
0 |
0 |
if $seen_links{$link}
|
1515
|
0 |
0 |
if ($search_uri =~ /^\?/) { }
|
1522
|
0 |
0 |
if $link =~ m[^https?://]
|
1524
|
0 |
0 |
if $link =~ /.html?$/
|
1525
|
0 |
0 |
if $link =~ /.jpg$/
|
1526
|
0 |
0 |
if $link =~ /.gif$/
|
1528
|
0 |
0 |
if ($self->{'save_to'}{'ttl'}) { }
|
1533
|
0 |
0 |
if ($self->{'logger'})
|
1536
|
0 |
0 |
if (defined(my $sth = $dbh->prepare($query))) { }
|
|
0 |
0 |
elsif ($self->{'logger'}) { }
|
1538
|
0 |
0 |
if (my $href = $sth->fetchrow_hashref)
|
1539
|
0 |
0 |
if (my $path = $href->{'path'})
|
1540
|
0 |
0 |
if (-r $path) { }
|
1541
|
0 |
0 |
if ($self->{'logger'})
|
1549
|
0 |
0 |
if (not defined $creation or $href->{'creation'} < $creation)
|
1555
|
0 |
0 |
if ($self->{'logger'})
|
1566
|
0 |
0 |
if (defined $creation and my $ttl = $self->{'save_to'}{'ttl'})
|
1569
|
0 |
0 |
if ($changes and $expiration == 0 || $expiration >= time) { }
|
|
0 |
0 |
elsif ($expiration and $expiration < time) { }
|
1570
|
0 |
0 |
if ($self->{'logger'})
|
1572
|
0 |
0 |
if ($changes == 1) { }
|
1573
|
0 |
0 |
if ($self->{'save_to'}{'ttl'}) { }
|
1584
|
0 |
0 |
if (my $ttl = $self->{'save_to'}{'ttl'})
|
1589
|
0 |
0 |
if ($self->{'save_to'}{'ttl'}) { }
|
1597
|
0 |
0 |
if (my $path = $href->{'path'})
|
1598
|
0 |
0 |
if ($self->{'logger'})
|
1604
|
0 |
0 |
if ($self->{'save_to'}{'ttl'}) { }
|
1609
|
0 |
0 |
if ($self->{'logger'})
|