/** * Extracts all of the response information. * @param SimpleHttpResponse $response Response being parsed. * @access private */ protected function extractResponse($response) { $this->transport_error = $response->getError(); $this->raw = $response->getContent(); $this->sent = $response->getSent(); $this->headers = $response->getHeaders(); $this->method = $response->getMethod(); $this->url = $response->getUrl(); $this->request_data = $response->getRequestData(); }
/** * Extracts all of the response information. * @param SimpleHttpResponse $response Response being parsed. * @access private */ function _extractResponse($response) { $this->_transport_error = $response->getError(); $this->_raw = $response->getContent(); $this->_sent = $response->getSent(); $this->_headers = $response->getHeaders(); $this->_method = $response->getMethod(); $this->_url = $response->getUrl(); $this->_request_data = $response->getRequestData(); }
public function testParseOfResponseHeadersWhenChunked() { $socket = new MockSimpleSocket(); $socket->setReturnValueAt(0, "read", "HTTP/1.1 200 OK\r\nDate: Mon, 18 Nov 2002 15:50:29 GMT\r\n"); $socket->setReturnValueAt(1, "read", "Content-Type: text/plain\r\n"); $socket->setReturnValueAt(2, "read", "Server: Apache/1.3.24 (Win32) PHP/4.2.3\r\nConne"); $socket->setReturnValueAt(3, "read", "ction: close\r\n\r\nthis is a test file\n"); $socket->setReturnValueAt(4, "read", "with two lines in it\n"); $socket->setReturnValue("read", ""); $response = new SimpleHttpResponse($socket, new SimpleUrl('here'), new SimpleGetEncoding()); $this->assertFalse($response->isError()); $this->assertEqual($response->getContent(), "this is a test file\nwith two lines in it\n"); $headers = $response->getHeaders(); $this->assertIdentical($headers->getHttpVersion(), "1.1"); $this->assertIdentical($headers->getResponseCode(), 200); $this->assertEqual($headers->getMimeType(), "text/plain"); $this->assertFalse($headers->isRedirect()); $this->assertFalse($headers->getLocation()); }