芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/joolsmen.com/chat/vendor/ratchet/rfc6455/src/Handshake/ClientNegotiator.php
verifier = new ResponseVerifier; $this->defaultHeader = new Request('GET', '', [ 'Connection' => 'Upgrade' , 'Upgrade' => 'websocket' , 'Sec-WebSocket-Version' => $this->getVersion() , 'User-Agent' => "Ratchet" ]); } public function generateRequest(UriInterface $uri) { return $this->defaultHeader->withUri($uri) ->withHeader("Sec-WebSocket-Key", $this->generateKey()); } public function validateResponse(RequestInterface $request, ResponseInterface $response) { return $this->verifier->verifyAll($request, $response); } public function generateKey() { $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwzyz1234567890+/='; $charRange = strlen($chars) - 1; $key = ''; for ($i = 0; $i < 16; $i++) { $key .= $chars[mt_rand(0, $charRange)]; } return base64_encode($key); } public function getVersion() { return 13; } }