ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/tcp_websocket.ext
(Generate patch)

Comparing deliantra/server/ext/tcp_websocket.ext (file contents):
Revision 1.2 by root, Tue Nov 6 03:45:17 2012 UTC vs.
Revision 1.3 by root, Tue Nov 6 15:11:16 2012 UTC

4 4
5use Digest::SHA1 (); 5use Digest::SHA1 ();
6 6
7# websocket requests can be very long, and we want the tcp code to buffer for us 7# websocket requests can be very long, and we want the tcp code to buffer for us
8our $detector = ext::tcp::register websocket => 4096, sub { 8our $detector = ext::tcp::register websocket => 4096, sub {
9 m{^(?i:GET) \ (?i:http://[^/]+)? /ws \ (?:(?i)HTTP/[0-9\.]+)}xs 9 m{^(?i:GET) \ (?i:http://[^/]+)? /ws \ (?:(?i)HTTP/[0-9\.]+).*\015\012\015\012}xs
10}, sub { 10}, sub {
11 my ($id, $fh, $buf) = @_; 11 my ($id, $fh, $buf) = @_;
12 12
13 $buf =~ /^Sec-WebSocket-Version\s*:\s*([0-9]+)/mi 13 $buf =~ /^Sec-WebSocket-Version\s*:\s*([0-9]+)/mi
14 or return; 14 or return;
15 my $version = $1; # 8 ff10, 13 rfc 15 my $version = $1; # 8=ff10, 13=rfc
16 16
17 $buf =~ /^Sec-WebSocket-Key\s*:\s*(\S+)/mi 17 $buf =~ /^Sec-WebSocket-Key\s*:\s*(\S+)/mi
18 or return; 18 or return;
19 my $key = $1; 19 my $key = $1;
20 20

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines