public function testRecordOfSentCharacters() { $socket = new SimpleSocket('www.lastcraft.com', 80, 15); $this->assertTrue($socket->write("GET /test/network_confirm.php HTTP/1.0\r\n")); $socket->write("Host: www.lastcraft.com\r\n"); $socket->write("Connection: close\r\n\r\n"); $socket->close(); $this->assertEqual($socket->getSent(), "GET /test/network_confirm.php HTTP/1.0\r\n" . "Host: www.lastcraft.com\r\n" . "Connection: close\r\n\r\n"); }
public function testRecordOfSentCharacters() { $socket = new SimpleSocket($this->host, $this->port, 15); $this->assertTrue($socket->write("GET /network_confirm.php HTTP/1.0\r\n")); $socket->write("Host: {$this->host}\r\n"); $socket->write("Connection: close\r\n\r\n"); $socket->close(); $this->assertEqual($socket->getSent(), "GET /network_confirm.php HTTP/1.0\r\n" . "Host: {$this->host}\r\n" . "Connection: close\r\n\r\n"); }
function testRecordOfSentCharacters() { $site = $this->getServerInfo(); $socket = new SimpleSocket($site['host'], $site['port'], 15); $this->assertTrue($socket->write("GET {$site['path']}network_confirm.php HTTP/1.0\r\n")); $socket->write("Host: {$site['host']}\r\n"); $socket->write("Connection: close\r\n\r\n"); $socket->close(); $this->assertEqual($socket->getSent(), "GET {$site['path']}network_confirm.php HTTP/1.0\r\n" . "Host: {$site['host']}\r\n" . "Connection: close\r\n\r\n"); }
/** * Constructor. Reads and parses the incoming * content and headers. * @param SimpleSocket $socket Network connection to fetch * response text from. * @param SimpleUrl $url Resource name. * @param mixed $encoding Record of content sent. * @access public */ function SimpleHttpResponse(&$socket, $url, $encoding) { $this->SimpleStickyError(); $this->_url = $url; $this->_encoding = $encoding; $this->_sent = $socket->getSent(); $this->_content = false; $raw = $this->_readAll($socket); if ($socket->isError()) { $this->_setError('Error reading socket [' . $socket->getError() . ']'); return; } $this->_parse($raw); }
/** * Constructor. Reads and parses the incoming * content and headers. * @param SimpleSocket $socket Network connection to fetch * response text from. * @param string $method HTTP request method. * @param SimpleUrl $url Resource name. * @param mixed $request_data Record of content sent. * @access public */ function SimpleHttpResponse(&$socket, $method, $url, $request_data = '') { $this->StickyError(); $this->_method = $method; $this->_url = $url; $this->_request_data = $request_data; $this->_sent = $socket->getSent(); $this->_content = false; $raw = $this->_readAll($socket); if ($socket->isError()) { $this->_setError('Error reading socket [' . $socket->getError() . ']'); return; } $this->_parse($raw); }
/** * Constructor. Reads and parses the incoming * content and headers. * @param SimpleSocket $socket Network connection to fetch * response text from. * @param SimpleUrl $url Resource name. * @param mixed $encoding Record of content sent. * @access public */ function __construct($socket, $url, $encoding) { parent::__construct(); $this->url = $url; $this->encoding = $encoding; $this->sent = $socket->getSent(); $this->content = false; $raw = $this->readAll($socket); if ($socket->isError()) { $this->setError('Error reading socket [' . $socket->getError() . ']'); return; } $this->parse($raw); }