File Coverage

blib/lib/WARC/Record/Replay/HTTP.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             package WARC::Record::Replay::HTTP; # -*- CPerl -*-
2              
3 3     3   56998 use strict;
  3         14  
  3         66  
4 3     3   11 use warnings;
  3         17  
  3         113  
5              
6 3     3   329 use WARC; *WARC::Record::Replay::HTTP::VERSION = \$WARC::VERSION;
  3         4  
  3         768  
7              
8             =for autoload
9             [WARC::Record::Replay]
10             field(Content-Type)=^application/http
11              
12             =cut
13              
14             our $Content_Deferred_Loading_Threshold;
15             our $Content_Maximum_Length;
16              
17             # set defaults only if not already set
18             $Content_Deferred_Loading_Threshold = 2 * (1<<20) # 2 MiB
19             unless defined $Content_Deferred_Loading_Threshold;
20             $Content_Maximum_Length = 128 * (1<<20) # 128 MiB
21             unless defined $Content_Maximum_Length;
22              
23             # From RFC2616:
24              
25             # CHAR =
26             # CTL =
27             # (octets 0 - 31) and DEL (127)>
28             # LWS = [CRLF] 1*( SP | HT )
29             # separators = "(" | ")" | "<" | ">" | "@"
30             # | "," | ";" | ":" | "\" | <">
31             # | "/" | "[" | "]" | "?" | "="
32             # | "{" | "}" | SP | HT
33             # token = 1*
34              
35             our $HTTP__LWS = qr/(?:\015\012)?[ \t]+/;
36             our $HTTP__separator = qr[[][)(><}{@,;:/"\\?=[:space:]]];
37             our $HTTP__not_separator = qr[[^][)(><}{@,;:/"\\?=[:space:]]];
38             our $HTTP__token = qr/[!#$%'*+-.0-9A-Z^_`a-z|~]+/;
39             our $HTTP__Version = qr[HTTP/\d+.\d+];
40              
41             # Request-Line = Method SP Request-URI SP HTTP-Version CRLF
42             # Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
43              
44             our $HTTP__Request_Line = qr[^($HTTP__token)\s+([^ ]+)\s+($HTTP__Version)$];
45             our $HTTP__Status_Line = qr[^($HTTP__Version)\s+(\d{3})\s+(.*)$];
46              
47 3         305 use constant HTTP_PARSE_REs =>
48             qw/ HTTP__LWS HTTP__separator HTTP__not_separator HTTP__token HTTP__Version
49 3     3   20 HTTP__Request_Line HTTP__Status_Line /;
  3         5  
50              
51             require WARC::Record::Replay::HTTP::Message;
52             require WARC::Record::Replay::HTTP::Request;
53             require WARC::Record::Replay::HTTP::Response;
54              
55             1;
56             __END__