[TYPO3-dev] Content-Length header wrong?

Neil Bertram neil at tasmanstudios.co.nz
Wed May 17 14:27:07 CEST 2006


Hi,

I'm trying to implement Apache 2's mod_cache in front of TYPO3 on a very 
busy web server. It hasn't been caching TYPO3 content, despite 
config.sendCacheHeaders being set, which confused me.

I discovered now that mod_cache will only cache the output if the 
Content-Length header is set. By setting 
config.enableContentLengthHeader TYPO3 will output this header when 
possible. Great!

Even with this header, mod_cache is refusing to cache the page. I also 
noticed Firefox locked up for a while as it loaded the page when the 
content-length header was enabled. This lead me to believe that the 
value being sent was incorrect. I think I was right...

For one page on the site, TYPO3 is specifying a length of 8527 bytes on 
the content-length header. From its browser cache, Firefox claims the 
length was 8522 bytes. I tried this for several pages and found each was 
out by a small (but varying) amount.

I realise the content-length code probably hasn't been touched since it 
was introduced in 2004, so is it possible that something has changed 
that makes strlen($this->content) in tslib_fe not a valid measurement? 
My first guess would be some postproc function like xhtml_cleaning is 
modifying the output after it gets measured, but I'm not sure.

I'd like to propose that content-length is only ever sent for pages 
retrieved from typo3's cache, that way the filesize of the cache file 
can be used to give an absolutely exact reading of the length going out 
on the wire.

Ideas?


Neil




More information about the TYPO3-dev mailing list