Posted by sun on August 11, 2011 at 3:06pm
5 followers
Jump to:
| Project: | Drupal core |
| Version: | 8.x-dev |
| Component: | base system |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
| Issue tags: | needs backport to D7 |
Issue Summary
All URI, networking, and communication errors are using negative, 0, or NULL status codes.
In various locations, drupal_http_request() ensures this by negating a potential status code:
<?php
// When a network error occurs, we use a negative number so it does not
// clash with the HTTP status codes.
$result->code = -$errno;
?>This was consistent until #156582: drupal_http_request() should support timeout setting came, which added:
<?php
/**
* Error code indicating that the request made by drupal_http_request() exceeded
* the specified timeout.
*/
define('HTTP_REQUEST_TIMEOUT', 1);
?>and directly returns:
<?php
if ($info['timed_out']) {
$result->code = HTTP_REQUEST_TIMEOUT;
$result->error = 'request timed out';
return $result;
}
?>All application-level error handling logic that previously checked for
// Catch 0, NULL, and any negative status code (networking errors).
if ($response->code <= 0) exit;now has to additionally check for the custom Drupalism and non-existing status code 1.
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| drupal.http-timeout.0.patch | 449 bytes | Idle | PASSED: [[SimpleTest]]: [MySQL] 33,646 pass(es). | View details |
Comments
#1
#2
#3
Committed to 8.x and 7.x. For 6.x we need to adjust #156582: drupal_http_request() should support timeout setting.
#4
#5
Doesn't this collide with the $errno returned by fsockopen() ?
#6
Automatically closed -- issue fixed for 2 weeks with no activity.