« blib/lib/auto/share/dist/Amon2/flavor/Minimum/script/server.pl
↑ Summary
blib/lib/Amon2/Setup/Flavor/Minimum.pm »
| 1 | package Amon2::Web::Response::Callback; | ||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use Carp (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use HTTP::Headers (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 3 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||
| 9 | 3 | my $class = shift; | |||||||||
| 10 | 0 | ▶ | my %args = @_ == 1 ? %{$_[0]} : @_; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 11 | 3 | ▶ | $args{code} || Carp::croak "Missing mandatory parameter: code"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 12 | 3 | bless { | |||||||||
| 13 | headers => HTTP::Headers->new, | ||||||||||
| 14 | %args | ||||||||||
| 15 | }, $class; | ||||||||||
| 16 | } | ||||||||||
| 17 | 0 | ▶ | sub header { | ||||||||
|
Subroutine
header: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 18 | 0 | my $self = shift; | |||||||||
| 19 | 0 | $self->headers->header(@_); | |||||||||
| 20 | } | ||||||||||
| 21 | 0 | ▶ | sub headers { $_[0]->{headers} } | ||||||||
|
Subroutine
headers: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 22 | 3 | ▶ | sub finalize { | ||||||||
|
Subroutine
finalize: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 23 | 3 | my $self = shift; | |||||||||
| 24 | 3 | delete $self->{headers}; | |||||||||
| 25 | |||||||||||
| 26 | # Defence from HTTP Header Splitting. | ||||||||||
| 27 | 3 | my $code = delete $self->{code}; | |||||||||
| 28 | 3 | ▶ | return sub { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 29 | 3 | my $responder = shift; | |||||||||
| 30 | $code->( | ||||||||||
| 31 | 3 | ▶ | sub { | ||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||
| 32 | 3 | my @copy = @{ $_[0]->[1] }; | |||||||||
| 33 | 3 | ▶ | while (my (undef, $val) = splice(@copy, 0, 2)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 4 | ▶ | if ($val =~ /[\000-\037]/) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 2 | die("Response headers MUST NOT contain characters below octal \037\n"); | |||||||||
| 36 | } | ||||||||||
| 37 | } | ||||||||||
| 38 | 1 | return $responder->(@_); | |||||||||
| 39 | } | ||||||||||
| 40 | 3 | ); | |||||||||
| 41 | 3 | }; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | |||||||||||
| 45 | 2 | 1; | |||||||||
| 46 | __END__ | ||||||||||