Branch Coverage

blib/lib/Protocol/WebSocket/Request.pm
Criterion Covered Total %
branch 105 114 92.1


line true false branch
24 2 7 @_ > 1 ? :
26 2 7 unless keys %$env
38 2 5 if ($env->{'HTTP_WEBSOCKET_PROTOCOL'}) { }
3 2 elsif ($env->{'HTTP_SEC_WEBSOCKET_PROTOCOL'}) { }
47 4 3 if (exists $env->{'HTTP_SEC_WEBSOCKET_VERSION'})
50 3 1 if ($env->{'HTTP_SEC_WEBSOCKET_VERSION'} eq '13') { }
58 4 3 if ($env->{'HTTP_SEC_WEBSOCKET_KEY'}) { }
1 2 elsif ($env->{'HTTP_SEC_WEBSOCKET_KEY1'}) { }
67 4 3 if ($version eq 'draft-ietf-hybi-10' or $version eq 'draft-ietf-hybi-17') { }
74 3 4 if ($env->{'HTTP_COOKIE'})
83 3 4 $env->{'QUERY_STRING'} ? :
87 1 6 if ($env->{'HTTP_X_FORWARDED_PROTO'} and $env->{'HTTP_X_FORWARDED_PROTO'} eq 'https')
97 32 13 if (@_ > 1) { }
99 23 9 unless $_[1]
101 9 0 if (my $cookies = $cookie->parse($_[1]))
110 42 59 @_ > 1 ? :
130 0 20 unless defined $self->resource_name
137 0 20 unless defined $self->host
140 8 12 if (ref $self->{'cookies'} eq 'Protocol::WebSocket::Cookie')
142 8 0 if $cookie_string
146 4 16 $self->origin ? :
147 3 17 if $self->secure
148 2 18 $version eq 'draft-ietf-hybi-10' ? :
157 9 11 if ($version eq 'draft-ietf-hybi-10' or $version eq 'draft-ietf-hybi-17') { }
7 4 elsif ($version eq 'draft-ietf-hybi-00') { }
4 0 elsif ($version eq 'draft-hixie-75') { }
160 3 6 unless ($key)
169 2 7 if defined $self->subprotocol
173 7 2 $version eq 'draft-ietf-hybi-17' ? :
181 1 6 if defined $self->subprotocol
191 1 3 if defined $self->subprotocol
207 7 13 if $version eq 'draft-ietf-hybi-00'
217 30 169 if (not $self->{'finalized'} and $self->is_body || $self->is_done)
220 7 23 if ($self->key1 and $self->key2) { }
11 12 elsif ($self->key) { }
224 7 4 if ($self->field('sec-websocket-version') eq '13') { }
235 2 28 unless ($self->_finalize)
249 2 25 unless ($req and $resource_name and $http)
254 0 25 unless ($req eq 'GET' and $http eq 'HTTP/1.1')
267 8 24 if ($self->key1 and $self->key2)
268 2 6 if length $self->{'buffer'} < 8
274 1 29 if (length $self->{'buffer'})
286 2 38 if (defined $value)
291 20 18 if defined $self->{$name}
301 170 12 unless (defined $value)
302 9 161 if (my $value = delete $self->{$name})
317 1 6 unless ($self->key1)
323 1 6 unless ($self->key2)
329 1 6 unless $self->challenge
362 7 5 int rand 2 ? :
401 0 30 unless $self->upgrade and lc $self->upgrade eq 'websocket'
404 0 30 unless $connection
407 1 29 unless grep {lc $_ eq 'upgrade';} @connections
413 29 0 if (defined $self->origin)
414 2 27 if $self->origin =~ /^https:/
418 1 28 unless $host
423 13 15 if $subprotocol