On Thu, 5 Mar 2009 19:14:20 +0100, Nisse Engström wrote:

> 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>

And I goofed: Transfer-Encoding is the stuff that says
"chunked". I was thinking of Content-Encoding. But the
section I refered to also says:

  "If a Content-Length header field (section 14.13) is present, its
   decimal value in OCTETs represents both the entity-length and the
   transfer-length. The Content-Length header field MUST NOT be sent
   if these two lengths are different"

[And a little further down, it mentions "that the
 recipient can arse it". I'm not sure quite what
 to make of that. :-)]

 -   -   -

Come to think about it, I've written some output handlers
to convert utf-8 to utf-16 or -32, which uses either
'Content-Length' or 'Transfer-Encoding: chunked' depending
on the size of the output. Perhaps I should change that to
always 'chunked'...


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to