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

Comparing deliantra/server/ext/tcp_http.ext (file contents):
Revision 1.1 by root, Tue Nov 6 01:25:48 2012 UTC vs.
Revision 1.2 by root, Tue Nov 6 03:45:17 2012 UTC

1#! perl # optional depends=tcp 1#! perl # optional depends=tcp
2 2
3# http server on base port 3# http server
4
5use Coro::AnyEvent;
6 4
7sub send { 5sub send {
8 my $self = $_[0]; 6 my $self = $_[0];
9 7
10 $self->{wbuf} .= $_[1]; 8 $self->{wbuf} .= $_[1];
118 } 116 }
119} 117}
120 118
121our $DETECTOR = ext::tcp::register http => 64, sub { 119our $DETECTOR = ext::tcp::register http => 64, sub {
122 # regex avoids conflict with websockets, which use /ws 120 # regex avoids conflict with websockets, which use /ws
123 m{^(?:(?i)GET|HEAD|OPTIONS) \ (?: [^/] | /[^w] | /w[^s] /ws[^\ ] ) }x 121 m{^(?i:GET|HEAD|OPTIONS) \ (?! (?i:http://[^/]+)? /ws \ ) }x
124}, sub { 122}, sub {
125 my $self = bless { 123 my $self = bless {
126 id => $_[0], 124 id => $_[0],
127 fh => $_[1], 125 fh => $_[1],
128 rbuf => $_[2], 126 rbuf => $_[2],

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines