James Cassell's Blog

Monday, September 05, 2005

I am currently attempting to figure out (or rather find) information on the HTTP size or content-size, whichever it is. On the W3C Validator page, it will display some of the information sent by the server. Some pages of my site don't send the content-size header, and others do. I am trying to find out why this is, and to correct it.

1 Comments:

  • Use the output buffering

    // this code is a replacement of ob_gzhandler()
    function output_handler($html) {
    $accept = $_SERVER['HTTP_ACCEPT_ENCODING'];
    if (strpos($accept, 'deflate') !== false) {
    $content = gzdeflate($html, 9);
    header('Content-encoding: deflate');
    } elseif (strpos($accept,'gzip') !== false) {
    $content = gzencode($html, 9);
    header('Content-encoding: gzip');
    } else {
    $content = $html;
    }
    header('Content-Length: ' . strlen($content));
    return $content;
    }
    ob_start("output_handler");

    By Anonymous Vladson, at 09 September, 2005 04:21  

Post a Comment

<< Home