Ver código fonte

Just echoing header info.

Signed-off-by: tianhe1986 <w1s2j3229@163.com>
tianhe1986 7 anos atrás
pai
commit
481b0982e9
1 arquivos alterados com 2 adições e 2 exclusões
  1. 2 2
      Protocols/Ws.php

+ 2 - 2
Protocols/Ws.php

@@ -399,12 +399,12 @@ class Ws
             //checking Sec-WebSocket-Accept
             if (preg_match("/Sec-WebSocket-Accept: *(.*?)\r\n/i", $buffer, $match)) {
                 if ($match[1] !== base64_encode(sha1($connection->websocketSecKey . "258EAFA5-E914-47DA-95CA-C5AB0DC85B11", true))) {
-                    echo "Sec-WebSocket-Accept not match. Buffer:" . $buffer . "\n";
+                    echo "Sec-WebSocket-Accept not match. Header:\n" . substr($buffer, 0, $pos) . "\n";
                     $connection->close();
                     return 0;
                 }
             } else {
-                echo "Sec-WebSocket-Accept not found. Buffer:" . $buffer . "\n";
+                echo "Sec-WebSocket-Accept not found. Header:\n" . substr($buffer, 0, $pos) . "\n";
                 $connection->close();
                 return 0;
             }