Skip to content

#280 Websocket server drop connection on attempting to receive text (… #281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 16, 2017

Conversation

kuai6
Copy link
Contributor

@kuai6 kuai6 commented Jul 16, 2017

…JSON) message more than 65535 bytes

In attempt to accept the message splitted into fragments the server does not respond to the requests. The reason - incorrect watermark range on the "EventBufferEvent" input buffer.

Also we have found out that the current WS protocol implementation doesn't correspond to RFC, namely section 4.4 Fragmentation (https://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10#section-4.4)

According to RFC:

A fragmented message consists of a single frame with the FIN bit
clear and an opcode other than 0, followed by zero or more frames
with the FIN bit clear and the opcode set to 0, and terminated by
a single frame with the FIN bit set and an opcode of 0.

The current implementation does not save first frame opcode value into variable.

This PR solves both problems described above.

Aleksey I. Kuleshov and others added 2 commits July 14, 2017 12:34
@@ -219,9 +224,12 @@ public function onRead()
}
if ($this->pool->maxAllowedPacket <= $dataLength) {
// Too big packet
Daemon::log(get_class($this) . ': MaxAllowedPacket limit exeed. Packet size ' . $dataLength . ' bytes when limit ' . $this->pool->maxAllowedPacket . ' bytes');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exceeded

@@ -29,6 +29,8 @@ class V13 extends Connection

protected $framebuf = '';

protected $firstFrameOpcodeName;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$frameOpcode?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property store first frame opcode name when message is fragmented. So it is $firstFrameOpcodeName. Why not ?

@kakserpom kakserpom merged commit 2acdcd9 into kakserpom:master Jul 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants