Lighttpd/mod mime

From Segfault
Jump to: navigation, search

mod_mime

$ curl -I http://nerdbynature.de/bits/2.6.39-rc4/oom/messages-9.txt.gz
HTTP/1.1 200 OK
Date: Tue, 05 Jul 2011 02:23:05 GMT
Server: Apache
Accept-Ranges: bytes
Content-Length: 16893
Content-Type: text/plain
Content-Encoding: x-gzip
Last-Modified: Mon, 02 May 2011 19:52:08 GMT
ETag: "f81daa41-41fd-4dbf0b68"
$ curl -kI https://trent.utfs.org/p/bits/2.6.39-rc4/oom/trace/16-messages.txt.gz
HTTP/1.1 200 OK
Date: Tue, 05 Jul 2011 02:25:24 GMT
Server: lighttpd/1.4.29-devel
Accept-Ranges: bytes
Content-Length: 358841
Content-Type: application/octet-stream

With mimetype.assign += ".gz" => "text/plain", our "Content-Type" changes, but still no Content-Encoding tag:

$ curl -kI https://trent.utfs.org/p/bits/2.6.39-rc4/oom/trace/16-messages.txt.gz
HTTP/1.1 200 OK
Date: Tue, 05 Jul 2011 02:34:28 GMT
Server: lighttpd/1.4.29-devel
Accept-Ranges: bytes
Content-Length: 358841
Content-Type: text/plain
ETag: "1713773856"
Last-Modified: Wed, 04 May 2011 18:52:14 GMT

With "setenv.add-response-header = ( "Content-Encoding" => "x-gzip" )" and "mimetype.assign = ( ".gz" => "text/plain" )" we'll receive our Content-Encoding tag:

$ curl -kI https://trent.utfs.org/p/bits/2.6.39-rc4/oom/trace/16-messages.txt.gz
HTTP/1.1 200 OK
Date: Tue, 05 Jul 2011 02:50:20 GMT
Server: lighttpd/1.4.29-devel
Accept-Ranges: bytes
Content-Length: 358841
Content-Type: text/plain
Content-Encoding: x-gzip
ETag: "1713773856"
Last-Modified: Wed, 04 May 2011 18:52:14 GMT

...but Firefox just won't recognize it and displays the .gz file in compressed form.