Last modified: 2009-06-02 01:52:34 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 19049 - Not all CSS compressed
Not all CSS compressed
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
All All
: Normal minor (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2009-06-02 00:33 UTC by Dan Jacobson
Modified: 2009-06-02 01:52 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Dan Jacobson 2009-06-02 00:33:45 UTC
Not all HTTP responses are getting compressed. Those that aren't I mark
with "!":

# tcpflow -i lo
# firefox mysite #here on localhost
#find -name\* -newer /tmp/d|xargs -r ls -t|xargs strings -n 11|
perl -nwe 'next unless /Content-(Encoding|Length|Type)|HTTP/;chomp;
$g=1 if /: gzip/;if(/HTTP/){$g=0;print"\n";next};
if(/Content-(Length|Type)/){print $g?" ":"!"}else{print" "};print"$_\n"'

 Content-Encoding: gzip
 Content-Length: 64
 Content-Type: text/css; charset=UTF-8

!Content-Length: 1078
!Content-Type: image/png

 Content-Encoding: gzip
 Content-Length: 81
 Content-Type: text/css; charset=UTF-8

!Content-Length: 923
!Content-Type: image/gif

 Content-Encoding: gzip
 Content-Length: 20
 Content-Type: text/html; charset=utf-8

 Content-Encoding: gzip
 Content-Length: 3809
 Content-Type: text/html; charset=UTF-8

!Content-Length: 8973
!Content-Type: text/css

!Content-Length: 4852
!Content-Type: text/css

!Content-Length: 27564
!Content-Type: text/css

 Content-Encoding: gzip
 Content-Length: 70
 Content-Type: text/css; charset=UTF-8

!Content-Length: 50
!Content-Type: image/gif

 Content-Encoding: gzip
 Content-Length: 92
 Content-Type: text/css; charset=UTF-8

!Content-Length: 1933
!Content-Type: image/png

!Content-Length: 7881
!Content-Type: image/jpeg

Running the above thru an additional
grep Content-Type|sort -ubd
!Content-Type: image/gif
!Content-Type: image/jpeg
!Content-Type: image/png
!Content-Type: text/css
 Content-Type: text/css; charset=UTF-8
 Content-Type: text/html; charset=UTF-8
 Content-Type: text/html; charset=utf-8
shows none of the images, only some of the CSS, and all of the HTML is
compressed. We also note the varying capitalization of "UTF".
# apt-show-versions apache2
apache2/unstable uptodate 2.2.11-5
Comment 1 Aryeh Gregor (not reading bugmail, please e-mail directly) 2009-06-02 00:41:59 UTC
The images are already compressed.  gzipping PNG, GIF, or JPEG files would provide no noticeable decrease in size.  E.g., one PNG on my computer is 1690090 bytes raw, and 1689871 bytes piped through gzip, a savings of 219 bytes or 0.01%.  The CSS should be compressed, and I'm pretty sure there's a bug open for that somewhere.
Comment 2 Dan Jacobson 2009-06-02 00:52:22 UTC
Oops. fixing Summary. See also bug 15944.
Comment 3 Aryeh Gregor (not reading bugmail, please e-mail directly) 2009-06-02 00:55:04 UTC
Which files aren't compressed?  Only the static .css files, right?  If so, this is a Wikimedia configuration issue, not a MediaWiki issue.  It needs a change to Apache config.
Comment 4 Dan Jacobson 2009-06-02 01:06:49 UTC
I was using vanilla MediaWiki 1.16 with vanilla
# apt-show-versions apache2
apache2/unstable uptodate 2.2.11-5
totally offline, so no Wikimedia involved.
$ find mediawiki/ \( -size 4852c -o -size 27564c -o -size 8973c \)|fgrep -v .svn|xargs ls -og
-rw-r--r-- 1  4852 2009-03-12 05:18 mediawiki/skins/common/commonPrint.css
-rw-r--r-- 1 27564 2009-05-31 07:56 mediawiki/skins/monobook/main.css
the third one must have changed size recently...
Comment 5 Aryeh Gregor (not reading bugmail, please e-mail directly) 2009-06-02 01:23:21 UTC
This is a web server configuration issue.  MediaWiki is not involved in serving static files, it just provides them for the web server to serve however it likes.  You have to configure your web server to compress .css/.js files it serves.  For instance, on lighttpd, this instructive would work with mod_compress enabled:

compress.cache-dir          = "/var/cache/lighttpd/compress/"
compress.filetype           = ("text/plain", "text/html", "application/x-javascript", "text/css", "text/javascript", "text/xml")
Comment 6 Dan Jacobson 2009-06-02 01:52:34 UTC
Wait, I think I found out why... this is not an area for junior programmer me, bye!
$ sed 's/^/>/' /etc/apache2/mods-available/deflate.conf
><IfModule mod_deflate.c>
>          # these are known to be safe with MSIE 6
>          AddOutputFilterByType DEFLATE text/html text/plain text/xml
>          # everything else may cause problems with MSIE 6
>          AddOutputFilterByType DEFLATE text/css
>          AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
>          AddOutputFilterByType DEFLATE application/rss+xml

Note You need to log in before you can comment on or make changes to this bug.