| 1 | package WARC::Record::Replay::HTTP; # -*- CPerl -*- | ||||||||||
| 2 | |||||||||||
| 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 | |||||||||||
| 6 | 5 | ▶ | use WARC; *WARC::Record::Replay::HTTP::VERSION = \$WARC::VERSION; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | =for autoload | ||||||||||
| 9 | [WARC::Record::Replay] | ||||||||||
| 10 | field(Content-Type)=^application/http | ||||||||||
| 11 | |||||||||||
| 12 | =cut | ||||||||||
| 13 | |||||||||||
| 14 | 4 | our $Content_Deferred_Loading_Threshold; | |||||||||
| 15 | 4 | our $Content_Maximum_Length; | |||||||||
| 16 | |||||||||||
| 17 | # set defaults only if not already set | ||||||||||
| 18 | 4 | ▶ | $Content_Deferred_Loading_Threshold = 2 * (1<<20) # 2 MiB | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | unless defined $Content_Deferred_Loading_Threshold; | ||||||||||
| 20 | 4 | ▶ | $Content_Maximum_Length = 128 * (1<<20) # 128 MiB | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | unless defined $Content_Maximum_Length; | ||||||||||
| 22 | |||||||||||
| 23 | # From RFC2616: | ||||||||||
| 24 | |||||||||||
| 25 | # CHAR = <any US-ASCII character (octets 0 - 127)> | ||||||||||
| 26 | # CTL = <any US-ASCII control character | ||||||||||
| 27 | # (octets 0 - 31) and DEL (127)> | ||||||||||
| 28 | # LWS = [CRLF] 1*( SP | HT ) | ||||||||||
| 29 | # separators = "(" | ")" | "<" | ">" | "@" | ||||||||||
| 30 | # | "," | ";" | ":" | "\" | <"> | ||||||||||
| 31 | # | "/" | "[" | "]" | "?" | "=" | ||||||||||
| 32 | # | "{" | "}" | SP | HT | ||||||||||
| 33 | # token = 1*<any CHAR except CTLs or separators> | ||||||||||
| 34 | |||||||||||
| 35 | 4 | our $HTTP__LWS = qr/(?:\015\012)?[ \t]+/; | |||||||||
| 36 | 4 | our $HTTP__separator = qr[[][)(><}{@,;:/"\\?=[:space:]]]; | |||||||||
| 37 | 4 | our $HTTP__not_separator = qr[[^][)(><}{@,;:/"\\?=[:space:]]]; | |||||||||
| 38 | 4 | our $HTTP__token = qr/[!#$%'*+-.0-9A-Z^_`a-z|~]+/; | |||||||||
| 39 | 4 | 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 | 4 | our $HTTP__Request_Line = qr[^($HTTP__token)\s+([^ ]+)\s+($HTTP__Version)$]; | |||||||||
| 45 | 4 | our $HTTP__Status_Line = qr[^($HTTP__Version)\s+(\d{3})\s+(.*)$]; | |||||||||
| 46 | |||||||||||
| 47 | 5 | use constant HTTP_PARSE_REs => | |||||||||
| 48 | qw/ HTTP__LWS HTTP__separator HTTP__not_separator HTTP__token HTTP__Version | ||||||||||
| 49 | 5 | ▶ | HTTP__Request_Line HTTP__Status_Line /; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 50 | |||||||||||
| 51 | 4 | require WARC::Record::Replay::HTTP::Message; | |||||||||
| 52 | 4 | require WARC::Record::Replay::HTTP::Request; | |||||||||
| 53 | 4 | require WARC::Record::Replay::HTTP::Response; | |||||||||
| 54 | |||||||||||
| 55 | 4 | 1; | |||||||||
| 56 | __END__ | ||||||||||