Use HTTP/1.1 in header() calls
authorjens1o <jenshausdorf@gmail.com>
Sun, 23 Jul 2017 14:02:54 +0000 (16:02 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Sun, 23 Jul 2017 19:42:59 +0000 (21:42 +0200)
Using HTTP/1.0 forces mod_php into compatibility mode, HTTP/1.1 uses
default handling.

Closes #2351

wcfsetup/install/files/lib/form/SearchForm.class.php
wcfsetup/install/files/lib/page/MembersListPage.class.php
wcfsetup/install/files/lib/page/TaggedPage.class.php
wcfsetup/install/files/lib/page/TrophyListPage.class.php
wcfsetup/install/files/lib/page/TrophyPage.class.php
wcfsetup/install/files/lib/system/exception/AJAXException.class.php
wcfsetup/install/files/lib/system/exception/IllegalLinkException.class.php
wcfsetup/install/files/lib/system/exception/PermissionDeniedException.class.php
wcfsetup/install/files/lib/util/HeaderUtil.class.php

index 4c535248ff00fcd92da37ad73cc8bc446274244a..8bb51aa6bf0f06e034c9897cfa623c76bb481e72 100644 (file)
@@ -295,7 +295,7 @@ class SearchForm extends AbstractCaptchaForm {
         * Throws a NamedUserException on search failure.
         */
        public function throwNoMatchesException() {
-               @header('HTTP/1.0 404 Not Found');
+               @header('HTTP/1.1 404 Not Found');
                
                if (empty($this->query)) {
                        throw new NamedUserException(WCF::getLanguage()->get('wcf.search.error.user.noMatches'));
index 95e6d36c80c52b38260c785719e2130bc431bd10..8fbcdeef5bb0c750ce03332117f825e63a6a35da 100644 (file)
@@ -158,7 +158,7 @@ class MembersListPage extends SortablePage {
                ]);
                
                if (count($this->objectList) === 0) {
-                       @header('HTTP/1.0 404 Not Found');
+                       @header('HTTP/1.1 404 Not Found');
                }
        }
 }
index 3f39738a1745a74702748109ff3fa576e18c5f97..828b3b9b63db4e156474946187d9eba5c297ee65 100644 (file)
@@ -128,7 +128,7 @@ class TaggedPage extends MultipleLinkPage {
                ]);
                
                if (count($this->objectList) === 0) {
-                       @header('HTTP/1.0 404 Not Found');
+                       @header('HTTP/1.1 404 Not Found');
                }
        }
 }
index c097febf2278ead786784cbce9a6d27d4b3753c0..fc66926596339d8b3990e278c27c704bb5db95f8 100644 (file)
@@ -104,7 +104,7 @@ class TrophyListPage extends MultipleLinkPage {
                ]);
                
                if (count($this->objectList) === 0) {
-                       @header('HTTP/1.0 404 Not Found');
+                       @header('HTTP/1.1 404 Not Found');
                }
        }
 }
index bacca17432ab413656d527cd9491dd69eb714a33..4b533e02b98ce07b72e18be2147324d0d99e9e64 100644 (file)
@@ -142,7 +142,7 @@ class TrophyPage extends MultipleLinkPage {
                ]);
                
                if (count($this->objectList) === 0) {
-                       @header('HTTP/1.0 404 Not Found');
+                       @header('HTTP/1.1 404 Not Found');
                }
        }
 }
index d94c74e315456d5fa185ac30536365da6ba4434c..332bac446ed51e472d96b8ac710fbf202050405a 100644 (file)
@@ -90,30 +90,30 @@ class AJAXException extends LoggedException {
                $statusHeader = '';
                switch ($errorType) {
                        case self::MISSING_PARAMETERS:
-                               $statusHeader = 'HTTP/1.0 400 Bad Request';
+                               $statusHeader = 'HTTP/1.1 400 Bad Request';
                                
                                $responseData['exceptionID'] = $exceptionID;
                                $responseData['message'] = WCF::getLanguage()->get('wcf.ajax.error.badRequest');
                        break;
                        
                        case self::SESSION_EXPIRED:
-                               $statusHeader = 'HTTP/1.0 409 Conflict';
+                               $statusHeader = 'HTTP/1.1 409 Conflict';
                        break;
                        
                        case self::INSUFFICIENT_PERMISSIONS:
-                               $statusHeader = 'HTTP/1.0 403 Forbidden';
+                               $statusHeader = 'HTTP/1.1 403 Forbidden';
                        break;
                        
                        case self::BAD_PARAMETERS:
-                               $statusHeader = 'HTTP/1.0 431 Bad Parameters';
+                               $statusHeader = 'HTTP/1.1 431 Bad Parameters';
                                
                                $responseData['exceptionID'] = $exceptionID;
                        break;
                        
                        default:
                        case self::INTERNAL_ERROR:
-                               //header('HTTP/1.0 418 I\'m a Teapot');
-                               header('HTTP/1.0 503 Service Unavailable');
+                               //header('HTTP/1.1 418 I\'m a Teapot');
+                               header('HTTP/1.1 503 Service Unavailable');
                                
                                $responseData['code'] = self::INTERNAL_ERROR;
                                $responseData['exceptionID'] = $exceptionID;
index 21c67f0a733be088e2c67236617fd2cdb6748563..87a035caf2aa2c8e56eec2e2d5a5c71535bfb555 100644 (file)
@@ -22,7 +22,7 @@ class IllegalLinkException extends NamedUserException {
         * @inheritDoc
         */
        public function show() {
-               @header('HTTP/1.0 404 Not Found');
+               @header('HTTP/1.1 404 Not Found');
                
                WCF::getTPL()->assign([
                        'title' => WCF::getLanguage()->getDynamicVariable('wcf.page.error.illegalLink.title')
index 2a6435f11f06ed2762da04477a16df12ebe441d3..2b0cf4310891f4c38b207a8d57d6c1ff435e8cd7 100644 (file)
@@ -33,7 +33,7 @@ class PermissionDeniedException extends UserException {
                }
                SessionHandler::getInstance()->disableTracking();
                
-               @header('HTTP/1.0 403 Forbidden');
+               @header('HTTP/1.1 403 Forbidden');
                
                WCF::getTPL()->assign([
                        'name' => get_class($this),
index 955450cf8d2ff6e2e785e3f13b48e771e6756ad7..5ca4c8ac7e10798c0e20614c8e017d6aff54370a 100644 (file)
@@ -160,7 +160,7 @@ final class HeaderUtil {
        public static function redirect($location, $sendStatusCode = false, $temporaryRedirect = true) {
                if ($sendStatusCode) {
                        if ($temporaryRedirect) @header('HTTP/1.1 307 Temporary Redirect');
-                       else @header('HTTP/1.0 301 Moved Permanently');
+                       else @header('HTTP/1.1 301 Moved Permanently');
                }
                
                header('Location: '.$location);