(Bug 17970) {{PROTECTIONLEVEL}} should be able to return the status for pages besides...
[lhc/web/wiklou.git] / includes / WebRequest.php
index e251ac5..68d22a8 100644 (file)
@@ -192,7 +192,14 @@ class WebRequest {
         * @return array
         */
        public static function detectProtocolAndStdPort() {
-               return ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' ) ? array( 'https', 443 ) : array( 'http', 80 );
+               if ( ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' ) ||
+                       ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) &&
+                       $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) ) {
+                       $arr = array( 'https', 443 );
+               } else {
+                       $arr = array( 'http', 80 );
+               }
+               return $arr;
        }
 
        /**
@@ -1044,6 +1051,7 @@ HTML;
         *
         * @since 1.19
         *
+        * @throws MWException
         * @return String
         */
        protected function getRawIP() {
@@ -1306,6 +1314,10 @@ class FauxRequest extends WebRequest {
                return $this->wasPosted;
        }
 
+       public function getCookie( $key, $prefix = null, $default = null ) {
+               return $default;
+       }
+
        public function checkSessionCookie() {
                return false;
        }
@@ -1335,8 +1347,10 @@ class FauxRequest extends WebRequest {
         * @return mixed
         */
        public function getSessionData( $key ) {
-               if( isset( $this->session[$key] ) )
+               if( isset( $this->session[$key] ) ) {
                        return $this->session[$key];
+               }
+               return null;
        }
 
        /**