Merge "Make wfForeignMemcKey consistent with wfMemcKey"
[lhc/web/wiklou.git] / includes / WebResponse.php
index 8e15d71..c2193fb 100644 (file)
@@ -54,13 +54,13 @@ class WebResponse {
        public function setcookie( $name, $value, $expire = 0, $prefix = null, $domain = null, $forceSecure = null ) {
                global $wgCookiePath, $wgCookiePrefix, $wgCookieDomain;
                global $wgCookieSecure, $wgCookieExpiration, $wgCookieHttpOnly;
-               if ( $expire == 0 ) {
+               if ( $expire == 0 && $wgCookieExpiration != 0 ) {
                        $expire = time() + $wgCookieExpiration;
                }
-               if( $prefix === null ) {
+               if ( $prefix === null ) {
                        $prefix = $wgCookiePrefix;
                }
-               if( $domain === null ) {
+               if ( $domain === null ) {
                        $domain = $wgCookieDomain;
                }
 
@@ -116,7 +116,9 @@ class FauxResponse extends WebResponse {
                } else {
                        list( $key, $val ) = array_map( 'trim', explode( ":", $string, 2 ) );
 
-                       if( $replace || !isset( $this->headers[$key] ) ) {
+                       $key = strtoupper( $key );
+
+                       if ( $replace || !isset( $this->headers[$key] ) ) {
                                $this->headers[$key] = $val;
                        }
                }
@@ -127,10 +129,12 @@ class FauxResponse extends WebResponse {
        }
 
        /**
-        * @param $key string
+        * @param string $key The name of the header to get (case insensitive).
         * @return string
         */
        public function getheader( $key ) {
+               $key = strtoupper( $key );
+
                if ( isset( $this->headers[$key] ) ) {
                        return $this->headers[$key];
                }