Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Chrome 19 error after getting response: "A server must not mask any frames that it sends to the client."

オープン
#55 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
php
領域
networking

調査の方向性

websocket.class.php とその encode 関数から始め、次に php server.php を実行して、issue に記載されている Chrome 19 の接続およびエコーのフローを再現します。サーバーからクライアントへのフレーム処理を、参照されている hybi10Encode 実装と比較します。Chrome がサーバーフレームがマスクされていると報告せずにエコーバックされたメッセージを受け入れれば完了です。

索引モデルが issue の本文から書いたものです。

説明

auto-migrated Priority-Medium Type-Defect
Chrome 19 stops connection after receiving message from server with: "A server 
must not mask any frames that it sends to the client."

What steps will reproduce the problem?
First you have to fix chrome so it doesn't disconnect imediatly apon connecting 
by replacing this line:
preg_match ("#Sec-WebSocket-Origin: (.*?)\r\n#", $buffer, $match) && $origin = 
$match[1];
with
preg_match ("#Origin: (.*?)\r\n#", $buffer, $match) && $origin = $match[1];

Then connect to the server with:
php server.php

Then refresh the chrome browser. Firefox 12 works fine.
Send a message to in the chrome 19 browser. It will get to the server and be 
send back. 
This error appears in chrome console.
"A server must not mask any frames that it sends to the client."

I spent a few hours researching the problem and found the solution.
The encode function is the problem.

I couldn't figure out how to not mask the data being sent to the server until I 
found a github example that works and has a flag you can set to not mask the 
data frames.
https://github.com/lemmingzshadow/php-websocket

I replaced the encode function in websocket.class.php with the one in the 
connection.php file in lemmingzshadow's github and it started working. The 
function is called: hybi10Encode in the \server\lib\WebSocket\connection.php 
file.
change this parameter in the function encode: $masked = true to $masked = false 

I am using windows 7 64bit with php 5.4.1

Also there is an updated version of this that might be of use to someone:
http://www.wilky.it/phpwebsocket-new-version/


Original issue reported on code.google.com by [email protected] on 30 Jun 2012 at 6:00

主要言語
PHP
スター
0
フォーク
0
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

et-nik/phpwebsocket のほかの issue

et-nik/phpwebsocket の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。