Don't send empty Vary headers.
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 20 Sep 2012 04:18:19 +0000 (21:18 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 20 Sep 2012 04:18:19 +0000 (21:18 -0700)
Change-Id: I0b6bd7ab24323782302c28cf1438dce62f5b8c5a

thumb.php

index cba44a9..9b21ab3 100644 (file)
--- a/thumb.php
+++ b/thumb.php
@@ -237,7 +237,9 @@ function wfStreamThumb( array $params ) {
                                if ( $wgVaryOnXFP ) {
                                        $varyHeader[] = 'X-Forwarded-Proto';
                                }
-                               $response->header( 'Vary: ' . implode( ', ', $varyHeader ) );
+                               if ( count( $varyHeader ) ) {
+                                       $response->header( 'Vary: ' . implode( ', ', $varyHeader ) );
+                               }
                                wfProfileOut( __METHOD__ );
                                return;
                        } else {
@@ -248,7 +250,9 @@ function wfStreamThumb( array $params ) {
                }
                $thumbPath = $img->getThumbPath( $thumbName );
                if ( $img->getRepo()->fileExists( $thumbPath ) ) {
-                       $headers[] = 'Vary: ' . implode( ', ', $varyHeader );
+                       if ( count( $varyHeader ) ) {
+                               $headers[] = 'Vary: ' . implode( ', ', $varyHeader );
+                       }
                        $img->getRepo()->streamFile( $thumbPath, $headers );
                        wfProfileOut( __METHOD__ );
                        return;
@@ -258,7 +262,10 @@ function wfStreamThumb( array $params ) {
                wfProfileOut( __METHOD__ );
                return;
        }
-       $headers[] = 'Vary: ' . implode( ', ', $varyHeader );
+
+       if ( count( $varyHeader ) ) {
+               $headers[] = 'Vary: ' . implode( ', ', $varyHeader );
+       }
 
        // Thumbnail isn't already there, so create the new thumbnail...
        try {