[dokuwiki] Quirks with css.php and js.php and HTTP_IF_MODIFIED_SINCE if compression (gzip output=1) is on
- From: Jens Wilke <jw_list@xxxxxxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Mon, 21 Jan 2008 16:16:10 +0100
Hi!
I am using DokuWiki 2007-06-26b with PHP-4.4.2.
When compression is turned on my browser does not get a result
for request to lib/exe/css.php or lib/exe/js.php from time to time.
The "user experience" is:
After 15 second after the page request I get a page redered in the browser
without CSS applied. Howerver that may look different since I am using
a reverse proxy between browser and the DokuWiki installation.
I narrowed the problem down to the following: When
HTTP_IF_MODIFIED_SINCE is set and the result is not modified
DokuWiki sends a "304 Not Modified"
(done by inc/pageutils.php function http_conditionalRequest($timestamp))
The tcpdump output of this response is:
0x0000: 4500 0146 a56e 4000 4006 5806 0a0a 1415 E..F.n@.@.X.....
0x0010: 0a0a 1415 0050 be72 3d01 0ed1 3d30 6ffe .....P.r=...=0o.
0x0020: 8018 21e5 3d76 0000 0101 080a 2edd aaa5 ..!.=v..........
0x0030: 2edd aaa1 4854 5450 2f31 2e31 2033 3034 ....HTTP/1.1.304
0x0040: 204e 6f74 204d 6f64 6966 6965 640d 0a44 .Not.Modified..D
0x0050: 6174 653a 204d 6f6e 2c20 3231 204a 616e ate:.Mon,.21.Jan
0x0060: 2032 3030 3820 3132 3a34 343a 3431 2047 .2008.12:44:41.G
0x0070: 4d54 0d0a 5365 7276 6572 3a20 4170 6163 MT..Server:.Apac
0x0080: 6865 2f32 2e30 2e35 3520 2855 6275 6e74 he/2.0.55.(Ubunt
0x0090: 7529 2050 4850 2f34 2e34 2e32 2d31 6275 u).PHP/4.4.2-1bu
0x00a0: 696c 6431 206d 6f64 5f73 736c 2f32 2e30 ild1.mod_ssl/2.0
0x00b0: 2e35 3520 4f70 656e 5353 4c2f 302e 392e .55.OpenSSL/0.9.
0x00c0: 3861 0d0a 4554 6167 3a20 2238 3064 6239 8a..ETag:."80db9
0x00d0: 3065 6234 6437 6532 3333 3836 6561 3966 0eb4d7e23386ea9f
0x00e0: 6139 3033 3530 3131 3433 3422 0d0a 4361 a9035011434"..Ca
0x00f0: 6368 652d 436f 6e74 726f 6c3a 2070 7562 che-Control:.pub
0x0100: 6c69 632c 206d 6178 2d61 6765 3d33 3630 lic,.max-age=360
0x0110: 300d 0a56 6172 793a 2041 6363 6570 742d 0..Vary:.Accept-
0x0120: 456e 636f 6469 6e67 0d0a 0d0a 1f8b 0800 Encoding........
0x0130: 0000 0000 0003 0200 0000 ffff 0300 0000 ................
0x0140: 0000 0000 0000 ......
The problem is the garbage after the double newline. Since we are doing HTTP/1.1
and sending 304 there should be no content. This garbage is 0 byte with gzip
compression applied (checked it).
Anyone else stepped on this?
Fixes:
Don't turn on gzip compression. Or this patch:
--- dokuwiki-2007-06-26b/inc/pageutils.php 2007-06-26 20:27:15.000000000
+0200
+++ dokuwiki/inc/pageutils.php 2008-01-21 16:10:05.000000000 +0100
@@ -518,6 +518,10 @@
// Nothing has changed since their last request - serve a 304 and exit
header('HTTP/1.0 304 Not Modified');
+
+ // don't produce output, even if compression is on 2008-01-21;jw
+ ob_end_clean();
+
exit;
}
Best,
Jens
--
"Everything superfluous is wrong!"
// Jens Wilke - headissue GmbH - Munich - Germany
\// http://www.headissue.com
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
Other related posts: