Skip to content

Commit

Permalink
1005 status code must not be sent
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 12, 2013
1 parent 1b966c6 commit c381eee
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/Mojo/Transaction/WebSocket.pm
Expand Up @@ -272,11 +272,9 @@ sub _message {

# Close
if ($op == CLOSE) {
return $self->finish(1005) unless length $frame->[5] >= 2;
my $close = $self->{close} = [];
$close->[0] = unpack 'n', substr($frame->[5], 0, 2, '');
$close->[1] = decode 'UTF-8', $frame->[5];
return $self->finish(@$close);
return $self->finish unless length $frame->[5] >= 2;
return $self->finish(unpack('n', substr($frame->[5], 0, 2, '')),
decode('UTF-8', $frame->[5]));
}

# Append chunk and check message size
Expand Down

0 comments on commit c381eee

Please sign in to comment.