diff --git a/httprl.module b/httprl.module index 9b97358..a73a9e2 100644 --- a/httprl.module +++ b/httprl.module @@ -250,7 +250,7 @@ function httprl_request($url, $options = array()) { else { // When a network error occurs, we use a negative number so it does not // clash with the HTTP status codes. - $result->code = -$errno; + $result->code = (int) -$errno; $result->error = trim($errstr) ? trim($errstr) : t('Error opening socket @socket', array('@socket' => $socket)); } @@ -363,6 +363,8 @@ function httprl_send_request($fp = NULL, $url = '', $request = '', $options = '' // Connection was never made. else { $result->status = 'Connection not made.'; + $result->code = $request->code; + $result->error = $request->error; $counter++; return FALSE; } @@ -621,7 +623,7 @@ function httprl_parse_data(&$result) { // Parse the response status line. $protocol_code_array = explode(' ', trim(array_shift($response)), 3); $result->protocol = $protocol_code_array[0]; - $code = $protocol_code_array[1]; + $code = (int) $protocol_code_array[1]; // If the response does not include a description, don't try to process it. $result->status_message = isset($protocol_code_array[2]) ? $protocol_code_array[2] : ''; unset($protocol_code_array);