Skip to content

Commit

Permalink
fixed message size limit bug in Mojo::Transaction::WebSocket
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 11, 2013
1 parent 7b806e9 commit f21bf45
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Changes
@@ -1,12 +1,13 @@

3.95 2013-04-11
3.95 2013-04-12
- Added finished_ok method to Test::Mojo.
- Removed deprecated slurp_rel_file method from Mojo::Home.
- Removed deprecated html_escape function from Mojo::Util.
- Improved Mojo::Transaction::WebSocket with support for status codes and
reasons.
- Improved documentation. (jberger, sri)
- Improved tests.
- Fixed message size limit bug in Mojo::Transaction::WebSocket.
- Fixed a few small timing bugs in Mojo::Server::Daemon.
- Fixed small description bug in Test::Mojo.

Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Transaction/WebSocket.pm
Expand Up @@ -282,7 +282,7 @@ sub _message {
# Append chunk and check message size
$self->{op} = $op unless exists $self->{op};
$self->{message} .= $frame->[5];
$self->finish(1009) and last
return $self->finish(1009)
if length $self->{message} > $self->max_websocket_size;

# No FIN bit (Continuation)
Expand Down
4 changes: 4 additions & 0 deletions t/mojolicious/websocket_lite_app.t
Expand Up @@ -141,6 +141,10 @@ $t->send_ok({binary => 'x' x 262145})
$t->websocket_ok('/echo')->send_ok({binary => 'x' x 262145})
->finished_ok(1009);

# Binary message in two 64bit frames without FIN bit (too large)
$t->websocket_ok('/echo')->send_ok([0, 0, 0, 0, 2, 'x' x 100000])
->send_ok([0, 0, 0, 0, 0, 'x' x 162146])->finished_ok(1009);

# Plain alternative
$t->get_ok('/echo')->status_is(200)->content_is('plain echo!');

Expand Down

0 comments on commit f21bf45

Please sign in to comment.