Beispiel #1
0
 /**
  * Constructs a new http client response instance this is normally done by the HTTP client.
  *
  * @param MOXMAN_Http_HttpClient $client HTTP client instance to connect to request.
  * @param MOXMAN_Http_HttpClientRequest $req HTTP client request instance for the specified response.
  */
 public function __construct($client, $req, $contentLength = 0)
 {
     $this->client = $client;
     $this->req = $req;
     $this->inputStream = $client->getInputStream();
     $this->bufferSize = $client->getBufferSize();
     $this->chunkLength = 0;
     $this->contentIndex = 0;
     $this->readHead();
     $this->transferEncoding = strtolower($this->getHeader("transfer-encoding", ""));
     $this->contentEncoding = strtolower($this->getHeader("content-encoding", ""));
     $this->contentLength = $contentLength ? $contentLength : $this->getHeader("content-length", 0);
     $method = $req->getMethod();
     $code = $this->getCode();
     // These requests doesn't have a body
     if ($method == "head" || $code == 204 || $code == 304 || $method == "connect" && $code >= 200 && $code < 300) {
         $this->isEmptyBody = true;
     }
 }