From: Mark A. Hershberger Date: Thu, 21 Oct 2010 18:18:00 +0000 (+0000) Subject: * Followup r75064 — fix misleading doc comment X-Git-Tag: 1.31.0-rc.0~34391 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28?a=commitdiff_plain;h=014599f0428bb9488876a704f91d16399c7b7a20;p=lhc%2Fweb%2Fwiklou.git * Followup r75064 — fix misleading doc comment * Don't let redirects set the status object to an error. --- diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index 5ba2b8db19..ad1f30a033 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -386,8 +386,12 @@ class HttpRequest { } /** - * Sets the member variable status to a fatal status if the HTTP - * status code was not 200. + * Sets HTTPRequest status member to a fatal value with the error + * message if the returned integer value of the status code was + * not successful (< 300) or a redirect (>=300 and < 400). (see + * RFC2616, section 10, + * http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for a + * list of status codes.) * * @return nothing */ @@ -396,14 +400,16 @@ class HttpRequest { $this->parseHeader(); } - if ( (int)$this->respStatus !== 200 ) { + if ( (int)$this->respStatus > 399 ) { list( $code, $message ) = explode( " ", $this->respStatus, 2 ); $this->status->fatal( "http-bad-status", $code, $message ); } } /** - * Get the member variable status for an HTTP Request + * Get the integer value of the HTTP status code (e.g. 200 for "200 Ok") + * (see RFC2616, section 10, http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html + * for a list of status codes.) * * @return Integer */