| 1 | package Linux::Event::WebSocket::_Handshake; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 8 | ▶ | use v5.36; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 8 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 8 | ▶ | use Digest::SHA qw(sha1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 8 | ▶ | use MIME::Base64 qw(decode_base64 encode_base64); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 8 | ▶ | use URI (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 8 | ▶ | use Uniform::HTTP::Request; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 8 | ▶ | use Linux::Event::WebSocket::_Random; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 8 | my $GUID = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 8 | my $TOKEN_RE = qr/\A[!#\$%&'*+\-.^_`|~0-9A-Za-z]+\z/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 65 | ▶ | sub _trim ($value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_trim: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 65 | $value =~ s/\A[ \t]+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 65 | $value =~ s/[ \t]+\z//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 65 | return $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 83 | ▶ | sub _header_values ($message, $wanted) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_header_values: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 83 | my @value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 83 | for my $index (0 .. $message->header_count - 1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 349 | my $name = $message->header_name($index); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 349 | ▶ | push @value, $message->header_value($index) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | if lc($name) eq lc($wanted); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 83 | return @value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 44 | ▶ | sub _tokens ($where, @value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tokens: called CC=5 SCAR=16.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 44 | my @token; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 44 | for my $value (@value) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 38 | for my $token (split /,/, $value, -1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 40 | $token = _trim($token); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 40 | ▶ | croak "$where contains an empty token" if $token eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 40 | ▶ | croak "$where contains an invalid token '$token'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | if $token !~ $TOKEN_RE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 40 | push @token, $token; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 44 | return @token; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 34 | ▶ | sub _has_token ($message, $name, $wanted) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_has_token: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 34 | for my $token (_tokens($name, _header_values($message, $name))) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 35 | ▶ | return 1 if lc($token) eq lc($wanted); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 25 | ▶ | sub _singleton ($message, $name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_singleton: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 25 | my @value = _header_values($message, $name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 25 | ▶ | croak "WebSocket handshake requires $name" if !@value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 25 | ▶ | croak "WebSocket handshake contains duplicate $name" if @value > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 25 | return _trim($value[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 17 | ▶ | sub _valid_key ($key) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_valid_key: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 17 | ▶ | return 0 if $key !~ /\A[A-Za-z0-9+\/]{22}==\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 17 | return length(decode_base64($key)) == 16; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 17 | ▶ | sub _accept ($key) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_accept: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 17 | return encode_base64(sha1($key . $GUID), ''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 19 | ▶ | sub _checked_subprotocols ($where, $subprotocols) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_checked_subprotocols: called CC=7 SCAR=22.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 19 | ▶ | croak "$where: subprotocols must be an array reference" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | if ref($subprotocols) ne 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 19 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | my @copy; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 19 | for my $token (@$subprotocols) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 6 | ▶ | croak "$where: each subprotocol must be a WebSocket token" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not defined $token or ref $token or not $token =~ /$TOKEN_RE/u
not defined $token or ref $token
MC/DC0%0/3
not defined $token or ref $token or not $token =~ /$TOKEN_RE/u
not defined $token
ref $token
not $token =~ /$TOKEN_RE/u
Truth table25%1/4
not(A) or B or not(C)
A= not defined $tokenB= ref $tokenC= not $token =~ /$TOKEN_RE/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | if !defined($token) || ref($token) || $token !~ $TOKEN_RE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | croak "$where: duplicate subprotocol '$token'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 6 | ▶ | if $seen{$token}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 6 | push @copy, "$token"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 19 | return \@copy; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 10 | ▶ | sub server_from_request ($class, $request, %option) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
server_from_request: called CC=14 SCAR=27.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 10 | ▶ | croak 'server_from_request(): request object is required' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $request and ref $request
MC/DC0%0/2
defined $request and ref $request
defined $request
ref $request
Truth table33%1/3
A and B
A= defined $requestB= ref $request
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | if !defined($request) || !ref($request); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | my $supported = _checked_subprotocols( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 'server_from_request()', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 10 | ▶ | delete($option{subprotocols}) // [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
delete $option{"subprotocols"} // []
MC/DC100%1/1
delete $option{"subprotocols"} // []
delete $option{"subprotocols"}
Truth table100%2/2
A
A= delete $option{"subprotocols"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 10 | ▶ | croak 'server_from_request(): unknown option(s): ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | . join(', ', sort keys %option) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | if %option; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 10 | ▶ | croak 'WebSocket handshake method must be GET' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | if $request->method ne 'GET'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 9 | ▶ | croak 'WebSocket handshake requires HTTP/1.1' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not defined $request->version or $request->version ne "1.1"
MC/DC50%1/2
not defined $request->version or $request->version ne "1.1"
not defined $request->version
$request->version ne "1.1"
Truth table66%2/3
not(A) or B
A= not defined $request->versionB= $request->version ne "1.1"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | if !defined($request->version) || $request->version ne '1.1'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 8 | ▶ | croak 'WebSocket handshake Upgrade header must contain websocket' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | if !_has_token($request, 'Upgrade', 'websocket'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 8 | ▶ | croak 'WebSocket handshake Connection header must contain Upgrade' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | if !_has_token($request, 'Connection', 'Upgrade'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 8 | my $version = _singleton($request, 'Sec-WebSocket-Version'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 8 | ▶ | croak 'WebSocket handshake Sec-WebSocket-Version must be 13' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | if $version ne '13'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 8 | my $key = _singleton($request, 'Sec-WebSocket-Key'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 8 | ▶ | croak 'WebSocket handshake contains invalid Sec-WebSocket-Key' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | if !_valid_key($key); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 8 | my @offered = _tokens( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 'Sec-WebSocket-Protocol', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | _header_values($request, 'Sec-WebSocket-Protocol'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 8 | my %offered_seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 8 | for my $token (@offered) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | croak "WebSocket handshake contains duplicate subprotocol '$token'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 3 | ▶ | if $offered_seen{$token}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 8 | my %supported = map { $_ => 1 } @$supported; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 8 | my ($selected) = grep { $supported{$_} } @offered; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 8 | return bless { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | endpoint_type => 'server', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | key => $key, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | offered_subprotocols => \@offered, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | selected_subprotocol => $selected, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 8 | ▶ | sub apply_server_response ($class, $handshake, $response) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
apply_server_response: called CC=8 SCAR=23.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | croak 'apply_server_response(): handshake object is required' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | if !defined($handshake) || !ref($handshake) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 8 | ▶ | || !$handshake->isa($class) || $handshake->{endpoint_type} ne 'server'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
not defined $handshake && ref $handshake && $handshake->isa($class) or $handshake->{"endpoint_type"} ne "server"
defined $handshake && ref $handshake && $handshake->isa($class)
defined $handshake and ref $handshake
MC/DC0%0/4
not defined $handshake && ref $handshake && $handshake->isa($class) or $handshake->{"endpoint_type"} ne "server"
defined $handshake
ref $handshake
$handshake->isa($class)
$handshake->{"endpoint_type"} ne "server"
Truth table20%1/5
not(A and B && C) or D
A= defined $handshakeB= ref $handshakeC= $handshake->isa($class)D= $handshake->{"endpoint_type"} ne "server"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 8 | ▶ | croak 'apply_server_response(): response object is required' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $response and ref $response
MC/DC0%0/2
defined $response and ref $response
defined $response
ref $response
Truth table33%1/3
A and B
A= defined $responseB= ref $response
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | if !defined($response) || !ref($response); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 8 | $response->status(101); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 8 | $response->reason('Switching Protocols'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 8 | $response->header(Upgrade => 'websocket'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 8 | $response->header(Connection => 'Upgrade'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 8 | $response->header('Sec-WebSocket-Accept' => _accept($handshake->{key})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 8 | ▶ | if (defined $handshake->{selected_subprotocol}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | $response->header( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 'Sec-WebSocket-Protocol' => $handshake->{selected_subprotocol}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 2 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 8 | return $response; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 9 | ▶ | sub client_request ($class, $url, %option) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
client_request: called CC=31 SCAR=43.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 9 | ▶ | croak 'client_request(): URL must be a non-empty scalar' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not defined $url or ref $url or $url eq ""
not defined $url or ref $url
MC/DC0%0/3
not defined $url or ref $url or $url eq ""
not defined $url
ref $url
$url eq ""
Truth table25%1/4
not(A) or B or C
A= not defined $urlB= ref $urlC= $url eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | if !defined($url) || ref($url) || $url eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 9 | my $origin = delete $option{origin}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 9 | ▶ | croak 'client_request(): origin must be a scalar' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $origin and ref $origin
MC/DC0%0/2
defined $origin and ref $origin
defined $origin
ref $origin
Truth table66%2/3
A and B
A= defined $originB= ref $origin
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | if defined($origin) && ref($origin); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | my $subprotocols = _checked_subprotocols( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 'client_request()', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 9 | ▶ | delete($option{subprotocols}) // [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
delete $option{"subprotocols"} // []
MC/DC100%1/1
delete $option{"subprotocols"} // []
delete $option{"subprotocols"}
Truth table100%2/2
A
A= delete $option{"subprotocols"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 9 | ▶ | my $headers = delete($option{headers}) // []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
delete $option{"headers"} // []
MC/DC100%1/1
delete $option{"headers"} // []
delete $option{"headers"}
Truth table100%2/2
A
A= delete $option{"headers"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 9 | ▶ | croak 'client_request(): headers must be an array reference' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | if ref($headers) ne 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 9 | my $host_header = delete $option{host_header}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 9 | ▶ | croak 'client_request(): host_header must be a scalar' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $host_header and ref $host_header
MC/DC0%0/2
defined $host_header and ref $host_header
defined $host_header
ref $host_header
Truth table33%1/3
A and B
A= defined $host_headerB= ref $host_header
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | if defined($host_header) && ref($host_header); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 9 | my $key = delete $option{key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 9 | ▶ | $key = encode_base64( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | Linux::Event::WebSocket::_Random->bytes(16), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | ) if !defined $key; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 9 | ▶ | croak 'client_request(): key must be a valid base64-encoded 16-byte value' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $key or not _valid_key($key)
MC/DC0%0/2
ref $key or not _valid_key($key)
ref $key
not _valid_key($key)
Truth table33%1/3
A or not(B)
A= ref $keyB= not _valid_key($key)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | if ref($key) || !_valid_key($key); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 9 | ▶ | croak 'client_request(): unknown option(s): ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | . join(', ', sort keys %option) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | if %option; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 9 | my @extra; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 9 | for my $pair (@$headers) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 1 | ▶ | croak 'client_request(): each header must be a [name, value] pair' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $pair ne "ARRAY" or @$pair != 2
MC/DC0%0/2
ref $pair ne "ARRAY" or @$pair != 2
ref $pair ne "ARRAY"
@$pair != 2
Truth table33%1/3
A or B
A= ref $pair ne "ARRAY"B= @$pair != 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | if ref($pair) ne 'ARRAY' || @$pair != 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 1 | my ($name, $value) = @$pair; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 1 | ▶ | croak 'client_request(): header name and value must be scalars' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
not defined $name or ref $name or not defined $value or ref $value
not defined $name or ref $name or not defined $value
not defined $name or ref $name
MC/DC0%0/4
not defined $name or ref $name or not defined $value or ref $value
not defined $name
ref $name
not defined $value
ref $value
Truth table20%1/5
not(A) or B or not(C) or D
A= not defined $nameB= ref $nameC= not defined $valueD= ref $value
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | if !defined($name) || ref($name) || !defined($value) || ref($value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 1 | push @extra, [ "$name", "$value" ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 9 | my $uri = URI->new("$url"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 9 | my $target = $uri->path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 9 | ▶ | $target = '/' if !defined($target) || $target eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $target or $target eq ""
MC/DC0%0/2
not defined $target or $target eq ""
not defined $target
$target eq ""
Truth table33%1/3
not(A) or B
A= not defined $targetB= $target eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 9 | my $query = $uri->query; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 9 | ▶ | $target .= "?$query" if defined($query) && length($query); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $query and length $query
MC/DC50%1/2
defined $query and length $query
defined $query
length $query
Truth table66%2/3
A and B
A= defined $queryB= length $query
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 9 | ▶ | if (!defined $host_header) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | $host_header = $uri->authority; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | croak 'client_request(): URL must contain an authority' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $host_header or $host_header eq ""
MC/DC0%0/2
not defined $host_header or $host_header eq ""
not defined $host_header
$host_header eq ""
Truth table0%0/3
not(A) or B
A= not defined $host_headerB= $host_header eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | if !defined($host_header) || $host_header eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 9 | my @http_headers = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | [ Host => "$host_header" ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | [ Upgrade => 'websocket' ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | [ Connection => 'Upgrade' ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | [ 'Sec-WebSocket-Key' => "$key" ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | [ 'Sec-WebSocket-Version' => '13' ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 9 | ▶ | push @http_headers, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | [ 'Sec-WebSocket-Protocol' => join(', ', @$subprotocols) ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | if @$subprotocols; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 9 | ▶ | push @http_headers, [ Origin => "$origin" ] if defined $origin; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 9 | push @http_headers, @extra; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 9 | my $request = Uniform::HTTP::Request->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | method => 'GET', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | target => $target, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | version => '1.1', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | headers => \@http_headers, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 9 | my $handshake = bless { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | endpoint_type => 'client', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | key => "$key", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | offered_subprotocols => [ @$subprotocols ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | selected_subprotocol => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 9 | return ($handshake, $request); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 9 | ▶ | sub validate_client_response ($class, $handshake, $response) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_client_response: called CC=16 SCAR=32.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | croak 'validate_client_response(): handshake object is required' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | if !defined($handshake) || !ref($handshake) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 9 | ▶ | || !$handshake->isa($class) || $handshake->{endpoint_type} ne 'client'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
not defined $handshake && ref $handshake && $handshake->isa($class) or $handshake->{"endpoint_type"} ne "client"
defined $handshake && ref $handshake && $handshake->isa($class)
defined $handshake and ref $handshake
MC/DC0%0/4
not defined $handshake && ref $handshake && $handshake->isa($class) or $handshake->{"endpoint_type"} ne "client"
defined $handshake
ref $handshake
$handshake->isa($class)
$handshake->{"endpoint_type"} ne "client"
Truth table20%1/5
not(A and B && C) or D
A= defined $handshakeB= ref $handshakeC= $handshake->isa($class)D= $handshake->{"endpoint_type"} ne "client"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 9 | ▶ | croak 'validate_client_response(): response object is required' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $response and ref $response
MC/DC0%0/2
defined $response and ref $response
defined $response
ref $response
Truth table33%1/3
A and B
A= defined $responseB= ref $response
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | if !defined($response) || !ref($response); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 9 | ▶ | croak 'WebSocket handshake response status must be 101' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | if $response->status != 101; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 9 | ▶ | croak 'WebSocket handshake response Upgrade header must contain websocket' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | if !_has_token($response, 'Upgrade', 'websocket'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 9 | ▶ | croak 'WebSocket handshake response Connection header must contain Upgrade' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | if !_has_token($response, 'Connection', 'Upgrade'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 9 | my $accept = _singleton($response, 'Sec-WebSocket-Accept'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | croak 'WebSocket handshake response has invalid Sec-WebSocket-Accept' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 9 | ▶ | if $accept ne _accept($handshake->{key}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 8 | ▶ | croak 'WebSocket handshake response selected an unsupported extension' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | if _header_values($response, 'Sec-WebSocket-Extensions'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 8 | my @protocol = _header_values($response, 'Sec-WebSocket-Protocol'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 8 | ▶ | croak 'WebSocket handshake response contains duplicate Sec-WebSocket-Protocol' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | if @protocol > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 8 | ▶ | if (@protocol) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 2 | my @token = _tokens('Sec-WebSocket-Protocol', $protocol[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 2 | ▶ | croak 'WebSocket handshake response must select one subprotocol' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | if @token != 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 2 | my %offered = map { $_ => 1 } @{$handshake->{offered_subprotocols}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | croak "WebSocket handshake response selected unknown subprotocol '$token[0]'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 2 | ▶ | if !$offered{$token[0]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 2 | $handshake->{selected_subprotocol} = $token[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 8 | return $handshake; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 16 | ▶ | sub subprotocol ($class, $handshake) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
subprotocol: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 16 | return $handshake->{selected_subprotocol}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 8 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||