Re: PHP script lag (5 secs) when declaring mime type.

From: Date: Thu, 05 Mar 2009 18:14:20 +0000
Subject: Re: PHP script lag (5 secs) when declaring mime type.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-289390@lists.php.net to get a copy of this message
On Thu, 05 Mar 2009 15:45:35 +0100, Jsbeginner wrote: > <?php > header('Content-Type: application/x-javascript'); > header('Content-Length: '.filesize('test.js')); > readfile('test.js'); > ?> > > test.js is only a few lines long, and if I remove the header content > type the file loads instantaniously do it's not a problem with readfile. > I thought about zlib gzip taking maybe a long time to load but I've > changed the compression level from 6 to 1 and the file still has a the > same lag. Content-Length MUST NOT be sent when using a Transfer-Encoding (eg. gzip). See: <http://tools.ietf.org/html/rfc2616#section-4.4> Presumably, Apache (or the browser) is waiting for the "missing" content, and then times out. /Nisse

« previous php.general (#289390) next »