Chris@0: headers)) { Chris@0: throw new \RuntimeException('No headers have been received'); Chris@0: } Chris@0: Chris@0: // HTTP-version SP status-code SP reason-phrase Chris@0: $startLine = explode(' ', array_shift($this->headers), 3); Chris@0: $headers = \GuzzleHttp\headers_from_lines($this->headers); Chris@0: $normalizedKeys = \GuzzleHttp\normalize_header_keys($headers); Chris@0: Chris@0: if (!empty($this->options['decode_content']) Chris@0: && isset($normalizedKeys['content-encoding']) Chris@0: ) { Chris@0: $headers['x-encoded-content-encoding'] Chris@0: = $headers[$normalizedKeys['content-encoding']]; Chris@0: unset($headers[$normalizedKeys['content-encoding']]); Chris@0: if (isset($normalizedKeys['content-length'])) { Chris@0: $headers['x-encoded-content-length'] Chris@0: = $headers[$normalizedKeys['content-length']]; Chris@0: Chris@0: $bodyLength = (int) $this->sink->getSize(); Chris@0: if ($bodyLength) { Chris@0: $headers[$normalizedKeys['content-length']] = $bodyLength; Chris@0: } else { Chris@0: unset($headers[$normalizedKeys['content-length']]); Chris@0: } Chris@0: } Chris@0: } Chris@0: Chris@0: // Attach a response to the easy handle with the parsed headers. Chris@0: $this->response = new Response( Chris@0: $startLine[1], Chris@0: $headers, Chris@0: $this->sink, Chris@0: substr($startLine[0], 5), Chris@0: isset($startLine[2]) ? (string) $startLine[2] : null Chris@0: ); Chris@0: } Chris@0: Chris@0: public function __get($name) Chris@0: { Chris@0: $msg = $name === 'handle' Chris@0: ? 'The EasyHandle has been released' Chris@0: : 'Invalid property: ' . $name; Chris@0: throw new \BadMethodCallException($msg); Chris@0: } Chris@0: }