Skip to content

Commit

Permalink
Generate accept header again on repeated use
Browse files Browse the repository at this point in the history
  • Loading branch information
kelunik committed Dec 17, 2017
1 parent 1be49ff commit 9657af6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Handshake.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ public function generateRequest(): string {
}
}

if ($this->accept === null) {
$this->accept = \base64_encode(\random_bytes(self::ACCEPT_NONCE_LENGTH));
}
// This has to be generated for each connect attempt, once a new request has been generated,
// we use the new key for validation.
$this->accept = \base64_encode(\random_bytes(self::ACCEPT_NONCE_LENGTH));

return 'GET ' . $this->path . " HTTP/1.1\r\nConnection: Upgrade\r\nUpgrade: websocket\r\nSec-Websocket-Version: 13\r\nSec-Websocket-Key: {$this->accept}\r\n$headers\r\n";
}
Expand Down

0 comments on commit 9657af6

Please sign in to comment.