Skip to content

Commit

Permalink
fixed a few typos
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Sep 1, 2014
1 parent 44e331e commit 016c62a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions Changes
Expand Up @@ -1487,7 +1487,7 @@

2.93 2012-05-05
- Added remove method to Mojolicious::Routes::Route.
- Improved 32bit Perl support of Mojo::Transaction::WebSocket.
- Improved 32-bit Perl support of Mojo::Transaction::WebSocket.
(mikemagowan, sri)
- Improved exception handling of application and configuration file loaders.
- Improved exception handling of Mojolicious::Plugin::I18N.
Expand Down Expand Up @@ -2426,7 +2426,7 @@
- Modernized Mojo::HelloWorld.
- Improved HTML healing capabilities of Mojo::DOM::HTML.
- Improved HTML rendering in Mojo::DOM::HTML.
- Improved 64bit support in Mojo::Transaction::WebSocket.
- Improved 64-bit support in Mojo::Transaction::WebSocket.
- Fixed memory leak in Mojo::IOLoop::Client.
- Fixed memory leak in Mojolicious.
- Fixed small bug in Mojo::IOLoop::Server.
Expand Down Expand Up @@ -2671,7 +2671,7 @@
available.
- Updated jQuery to version 1.6.
- Fixed PSGI read error handling.
- Fixed 64bit WebSocket message bug.
- Fixed 64-bit WebSocket message bug.
- Fixed small Windows bug.

1.22 2011-05-02
Expand Down
22 changes: 11 additions & 11 deletions lib/Mojo/Transaction/WebSocket.pm
Expand Up @@ -49,15 +49,15 @@ sub build_frame {
$frame .= pack 'C', $masked ? ($len | 128) : $len;
}

# Extended payload (16bit)
# Extended payload (16-bit)
elsif ($len < 65536) {
warn "-- Extended 16bit payload ($len)\n$payload\n" if DEBUG;
warn "-- Extended 16-bit payload ($len)\n$payload\n" if DEBUG;
$frame .= pack 'Cn', $masked ? (126 | 128) : 126, $len;
}

# Extended payload (64bit with 32bit fallback)
# Extended payload (64-bit with 32-bit fallback)
else {
warn "-- Extended 64bit payload ($len)\n$payload\n" if DEBUG;
warn "-- Extended 64-bit payload ($len)\n$payload\n" if DEBUG;
$frame .= pack 'C', $masked ? (127 | 128) : 127;
$frame .= MODERN ? pack('Q>', $len) : pack('NN', 0, $len & 0xffffffff);
}
Expand Down Expand Up @@ -174,21 +174,21 @@ sub parse_frame {
my ($hlen, $len) = (2, $second & 0b01111111);
if ($len < 126) { warn "-- Small payload ($len)\n" if DEBUG }

# Extended payload (16bit)
# Extended payload (16-bit)
elsif ($len == 126) {
return undef unless length $$buffer > 4;
$hlen = 4;
$len = unpack 'n', substr($$buffer, 2, 2);
warn "-- Extended 16bit payload ($len)\n" if DEBUG;
warn "-- Extended 16-bit payload ($len)\n" if DEBUG;
}

# Extended payload (64bit with 32bit fallback)
# Extended payload (64-bit with 32-bit fallback)
elsif ($len == 127) {
return undef unless length $$buffer > 10;
$hlen = 10;
my $ext = substr $$buffer, 2, 8;
$len = MODERN ? unpack('Q>', $ext) : unpack('N', substr($ext, 4, 4));
warn "-- Extended 64bit payload ($len)\n" if DEBUG;
warn "-- Extended 64-bit payload ($len)\n" if DEBUG;
}

# Check message size
Expand Down Expand Up @@ -354,8 +354,8 @@ Mojo::Transaction::WebSocket - WebSocket transaction
=head1 DESCRIPTION
L<Mojo::Transaction::WebSocket> is a container for WebSocket transactions
based on L<RFC 6455|http://tools.ietf.org/html/rfc6455>. Note that 64bit
frames require a Perl with support for quads or they are limited to 32bit.
based on L<RFC 6455|http://tools.ietf.org/html/rfc6455>. Note that 64-bit
frames require a Perl with support for quads or they are limited to 32-bit.
=head1 EVENTS
Expand Down Expand Up @@ -490,7 +490,7 @@ object.
my $bool = $ws->masked;
$ws = $ws->masked($bool);
Mask outgoing frames with XOR cipher and a random 32bit key.
Mask outgoing frames with XOR cipher and a random 32-bit key.
=head2 max_websocket_size
Expand Down
2 changes: 1 addition & 1 deletion t/mojo/websocket.t
Expand Up @@ -420,7 +420,7 @@ $ua->websocket(
Mojo::IOLoop->start;
is $status, 1006, 'right status';

# 16bit length
# 16-bit length
$result = undef;
$ua->websocket(
'/echo' => sub {
Expand Down
4 changes: 2 additions & 2 deletions t/mojo/websocket_frames.t
Expand Up @@ -153,7 +153,7 @@ is $frame->[4], 2, 'binary frame';
is $frame->[5], 'a', 'right payload';
is $bytes = $ws->build_frame(1, 0, 0, 0, 2, 'a'), $bytes, 'frames are equal';

# 16bit text frame roundtrip
# 16-bit text frame roundtrip
$ws = Mojo::Transaction::WebSocket->new;
$bytes = $ws->build_frame(1, 0, 0, 0, 1, 'hi' x 10000);
is $bytes, "\x81\x7e\x4e\x20" . ("\x68\x69" x 10000), 'right frame';
Expand All @@ -166,7 +166,7 @@ is $frame->[4], 1, 'text frame';
is $frame->[5], 'hi' x 10000, 'right payload';
is $ws->build_frame(1, 0, 0, 0, 1, 'hi' x 10000), $bytes, 'frames are equal';

# 64bit text frame roundtrip
# 64-bit text frame roundtrip
$ws = Mojo::Transaction::WebSocket->new(max_websocket_size => 500000);
$bytes = $ws->build_frame(1, 0, 0, 0, 1, 'hi' x 200000);
is $bytes, "\x81\x7f\x00\x00\x00\x00\x00\x06\x1a\x80" . ("\x68\x69" x 200000),
Expand Down
6 changes: 3 additions & 3 deletions t/mojolicious/websocket_lite_app.t
Expand Up @@ -142,19 +142,19 @@ $t->websocket_ok('/echo')->send_ok(0)->message_ok->message_is('echo: 0')
->send_ok(0)->message_ok->message_like({text => qr/0/})->finish_ok(1000)
->finished_ok(1000);

# 64bit binary message (extended limit)
# 64-bit binary message (extended limit)
$t->request_ok($t->ua->build_websocket_tx('/echo'));
is $t->tx->max_websocket_size, 262144, 'right size';
$t->tx->max_websocket_size(262145);
$t->send_ok({binary => 'a' x 262145})
->message_ok->message_is({binary => 'a' x 262145})
->finish_ok->finished_ok(1005);

# 64bit binary message (too large)
# 64-bit binary message (too large)
$t->websocket_ok('/echo')->send_ok({binary => 'b' x 262145})
->finished_ok(1009);

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

Expand Down

0 comments on commit 016c62a

Please sign in to comment.