enqueueResponseMethodMatch() public method

public enqueueResponseMethodMatch ( $method )
Example #1
0
 public function testKeepAliveHeadResponseParse()
 {
     $request = "HTTP/1.1 200 OK\n\n";
     $msgParser = new Parser(Parser::MODE_RESPONSE);
     $msgParser->enqueueResponseMethodMatch('HEAD');
     $parsedResponseArr = $msgParser->parse($request);
     $this->assertEquals(200, $parsedResponseArr['status']);
 }
Example #2
0
 private function onCryptoCompletion(RequestCycle $cycle)
 {
     $parser = new Parser(Parser::MODE_RESPONSE);
     $parser->enqueueResponseMethodMatch($cycle->request->getMethod());
     $parser->setAllOptions([Parser::OP_DISCARD_BODY => $cycle->options[self::OP_DISCARD_BODY], Parser::OP_RETURN_BEFORE_ENTITY => true, Parser::OP_BODY_DATA_CALLBACK => function ($data) use($cycle) {
         $cycle->futureResponse->update([Notify::RESPONSE_BODY_DATA, $data]);
     }]);
     $cycle->parser = $parser;
     $cycle->readWatcher = $this->reactor->onReadable($cycle->socket, function () use($cycle) {
         $this->onReadableSocket($cycle);
     });
     $timeout = $cycle->options[self::OP_MS_TRANSFER_TIMEOUT];
     if ($timeout > 0) {
         $cycle->transferTimeoutWatcher = $this->reactor->once(function () use($cycle, $timeout) {
             $this->fail($cycle, new TimeoutException(sprintf('Allowed transfer timeout exceeded: %d ms', $timeout)));
         }, $timeout);
     }
     $this->writeRequest($cycle);
 }