• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

keitaircメインレポジトリ


Commit MetaInfo

修订版b978c5726ac88e07fac918e9765582d82c389fe1 (tree)
时间2010-12-01 01:25:01
作者ISHIKAWA Mutsumi <ishikawa@hanz...>
CommiterISHIKAWA Mutsumi

Log Message

add websocket packet handling

更改概述

差异

--- a/lib/POE/Filter/HTTPD/Keitairc.pm
+++ b/lib/POE/Filter/HTTPD/Keitairc.pm
@@ -33,21 +33,27 @@ sub get_one_start {
3333
3434 sub get_one {
3535 my ($me) = @_;
36+ my $req = [];
3637
37- warn $me->[STRM],"\n";
38- my $req = $me->SUPER::get_one();
38+ if ($me->[STRM] =~ /^(?:\x00(.*)\xff|\xff\x00)$/) {
39+ $req = [$1];
40+ $me->[STRM] = '';
41+ } else {
42+ $req = $me->SUPER::get_one();
3943
40- if(defined $req->[0]) {
41- if ($req->[0]->header('Upgrade')
42- && $req->[0]->header('Upgrade') eq 'WebSocket'
43- && $req->[0]->header('Connection')
44- && $req->[0]->header('Connection') eq 'Upgrade') {
45- if ($me->[STRM] =~ /\r\n\r\n(.{8})$/) {
46- $req->[0]->content($1);
44+ if(defined $req->[0]) {
45+ if ($req->[0]->header('Upgrade')
46+ && $req->[0]->header('Upgrade') eq 'WebSocket'
47+ && $req->[0]->header('Connection')
48+ && $req->[0]->header('Connection') eq 'Upgrade') {
49+ if ($me->[STRM] =~ /\r\n\r\n(.{8})$/) {
50+ $req->[0]->content($1);
51+ }
4752 }
53+ $me->[STRM] = '';
4854 }
49- $me->[STRM] = '';
5055 }
56+
5157 return $req;
5258 }
5359