public function onAppend() { $this->bind->getData('client')->getTimestamp()->update(ServerTimestampType::RequestLast); $buffer = $this->bind->getBuffer(); if (!$this->firstLine) { if (false !== ($pos = $buffer->find("\r\n"))) { $rawFirstLine = $buffer->pop($pos, 2); $this->firstLine = FirstLine::factory($rawFirstLine); } } if ($this->firstLine && !$this->header) { if (false !== ($pos = $buffer->find("\r\n\r\n"))) { $rawHeader = $buffer->pop($pos, 4); $this->header = HttpHeader::factory($rawHeader); } } if ($this->header) { $httpContentLength = $this->header['HTTP_CONTENT_LENGTH']; if (($isEmptyBody = $this->firstLine->isEmptyBody()) || $buffer->size() >= $httpContentLength) { $rawBody = !$isEmptyBody ? $buffer->pop($httpContentLength) : ''; $request = Request::factory(['firstLine' => $this->firstLine, 'header' => $this->header, 'rawBody' => $rawBody]); $this->firstLine = null; $this->header = null; $this->bind->dispatch($request); $this->event->fire('http.pipeline:send', [$request]); } } }
protected function parseQuery() { $query = []; if ($rawQuery = $this->firstLine->getQuery()) { parse_str($rawQuery, $query); } $this->query = new ParameterStorage($query); }