From 014599f0428bb9488876a704f91d16399c7b7a20 Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Thu, 21 Oct 2010 18:18:00 +0000 Subject: [PATCH] =?utf8?q?*=20Followup=20r75064=20=E2=80=94=20fix=20mislea?= =?utf8?q?ding=20doc=20comment=20*=20Don't=20let=20redirects=20set=20the?= =?utf8?q?=20status=20object=20to=20an=20error.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- includes/HttpFunctions.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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 */ -- 2.20.1