Skip to content

Commit

Permalink
fixed small WebSocket handshake bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Nov 27, 2011
1 parent 92b535a commit 45eae00
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Changes
@@ -1,9 +1,10 @@
This file documents the revision history for Perl extension Mojolicious.

2.33 2011-11-26 00:00:00
2.33 2011-11-27 00:00:00
- Improved Mojo::EventEmitter performance slightly.
- Improved documentation.
- Fixed a few small inline template issues.
- Fixed small WebSocket handshake bug.

2.32 2011-11-24 00:00:00
- Added EXPERIMENTAL error event to Mojo::IOWatcher.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Headers.pm
Expand Up @@ -682,7 +682,7 @@ Shortcut for the C<Transfer-Encoding> header.
=head2 C<upgrade>
my $upgrade = $headers->upgrade;
$headers = $headers->upgrade('WebSocket');
$headers = $headers->upgrade('websocket');
Shortcut for the C<Upgrade> header.
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/Message/Request.pm
Expand Up @@ -219,8 +219,8 @@ sub _build_start_line {
my $clone = $url = $url->clone;
$clone->userinfo(undef);
$path = $clone
unless ($self->headers->upgrade || '') eq 'websocket'
|| ($url->scheme || '') eq 'https';
unless lc($self->headers->upgrade || '') eq 'websocket'
|| ($url->scheme || '') eq 'https';
}

# HTTP 0.9
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Transaction/HTTP.pm
Expand Up @@ -130,7 +130,7 @@ sub server_read {
elsif ((length $chunk == 0) || ($req->is_finished && !$self->{handled}++)) {
$self->emit(
upgrade => Mojo::Transaction::WebSocket->new(handshake => $self))
if (($req->headers->upgrade || '') eq 'websocket');
if lc($req->headers->upgrade || '') eq 'websocket';
$self->emit('request');
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/UserAgent/Transactor.pm
Expand Up @@ -171,8 +171,8 @@ sub proxy_connect {
# WebSocket and/or HTTPS
my $url = $req->url;
return
unless ($req->headers->upgrade || '') eq 'websocket'
|| ($url->scheme || '') eq 'https';
unless lc($req->headers->upgrade || '') eq 'websocket'
|| ($url->scheme || '') eq 'https';

# CONNECT request
my $new = $self->tx(CONNECT => $url->clone);
Expand Down

0 comments on commit 45eae00

Please sign in to comment.