Inheritance: extends SimpleStickyError
示例#1
0
 /**
  *    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();
 }
示例#2
0
 /**
  *    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();
 }
示例#3
0
 public function testRedirectWithPort()
 {
     $socket = new MockSimpleSocket();
     $socket->setReturnValueAt(0, "read", "HTTP/1.1 301 OK\r\n");
     $socket->setReturnValueAt(1, "read", "Content-Type: text/plain\r\n");
     $socket->setReturnValueAt(2, "read", "Location: http://www.somewhere-else.com:80/\r\n");
     $socket->setReturnValueAt(3, "read", "Connection: close\r\n");
     $socket->setReturnValueAt(4, "read", "\r\n");
     $socket->setReturnValue("read", "");
     $response = new SimpleHttpResponse($socket, new SimpleUrl('here'), new SimpleGetEncoding());
     $headers = $response->getHeaders();
     $this->assertTrue($headers->isRedirect());
     $this->assertEqual($headers->getLocation(), "http://www.somewhere-else.com:80/");
 }
示例#4
0
 function testReadAll()
 {
     $socket =& new MockSimpleSocket($this);
     $socket->setReturnValue("isError", false);
     $socket->setReturnValueSequence(0, "read", "aaa");
     $socket->setReturnValueSequence(1, "read", "bbb");
     $socket->setReturnValueSequence(2, "read", "ccc");
     $socket->setReturnValue("read", "");
     $this->assertEqual(SimpleHttpResponse::_readAll($socket), "aaabbbccc");
 }