Definition at line 39 of file SocketWrapper.php.
HTTP_Request2_SocketWrapper::__construct |
( |
|
$address, |
|
|
|
$timeout, |
|
|
array |
$contextOptions = array() |
|
) |
| |
Class constructor, tries to establish connection
- Parameters
-
string | $address | Address for stream_socket_client() call, e.g. 'tcp://localhost:80' |
int | $timeout | Connection timeout (seconds) |
array | $contextOptions | Context options |
- Exceptions
-
Definition at line 76 of file SocketWrapper.php.
HTTP_Request2_SocketWrapper::__destruct |
( |
| ) |
|
HTTP_Request2_SocketWrapper::checkTimeout |
( |
| ) |
|
|
protected |
Throws an Exception if stream timed out
- Exceptions
-
Definition at line 264 of file SocketWrapper.php.
HTTP_Request2_SocketWrapper::connectionWarningsHandler |
( |
|
$errno, |
|
|
|
$errstr |
|
) |
| |
|
protected |
Error handler to use during stream_socket_client() call
One stream_socket_client() call may produce multiple PHP warnings (especially OpenSSL-related), we keep them in an array to later use for the message of HTTP_Request2_ConnectionException
- Parameters
-
int | $errno | error level |
string | $errstr | error message |
- Returns
- bool
Definition at line 289 of file SocketWrapper.php.
HTTP_Request2_SocketWrapper::enableCrypto |
( |
| ) |
|
HTTP_Request2_SocketWrapper::eof |
( |
| ) |
|
HTTP_Request2_SocketWrapper::read |
( |
|
$length | ) |
|
Wrapper around fread(), handles global request timeout
- Parameters
-
int | $length | Reads up to this number of bytes |
- Returns
- string Data read from socket
- Exceptions
-
Definition at line 130 of file SocketWrapper.php.
HTTP_Request2_SocketWrapper::readLine |
( |
|
$bufferSize, |
|
|
|
$localTimeout = null |
|
) |
| |
Reads until either the end of the socket or a newline, whichever comes first
Strips the trailing newline from the returned data, handles global request timeout. Method idea borrowed from Net_Socket PEAR package.
- Parameters
-
int | $bufferSize | buffer size to use for reading |
int | $localTimeout | timeout value to use just for this call (used when waiting for "100 Continue" response) |
- Returns
- string Available data up to the newline (not including newline)
- Exceptions
-
Definition at line 153 of file SocketWrapper.php.
HTTP_Request2_SocketWrapper::setDeadline |
( |
|
$deadline, |
|
|
|
$timeout |
|
) |
| |
Sets request deadline
- Parameters
-
int | $deadline | Exception will be thrown if request continues past this time |
int | $timeout | Original request timeout value, to use in Exception message |
Definition at line 229 of file SocketWrapper.php.
HTTP_Request2_SocketWrapper::write |
( |
|
$data | ) |
|
Wrapper around fwrite(), handles global request timeout
- Parameters
-
string | $data | String to be written |
- Returns
- int
- Exceptions
-
Definition at line 197 of file SocketWrapper.php.
HTTP_Request2_SocketWrapper::$connectionWarnings = array() |
|
protected |
HTTP_Request2_SocketWrapper::$deadline |
|
protected |
HTTP_Request2_SocketWrapper::$socket |
|
protected |
HTTP_Request2_SocketWrapper::$timeout |
|
protected |
The documentation for this class was generated from the following file: