|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-08-20 07:05 UTC] phpbug at paypc dot com
Description:
------------
Very straightforward.
I have a preamble and postamble include on ALL of my main .php pages... which use ADODB session management, some PEAR, and other typical dynaweb goodies.
The Content-Length header is *ALWAYS* off by about 81 bytes, as in, the ob_get_length() is always smaller than the actual size of the content sent...
I've verified this with "netcat" - after trimming the headers from the reply, the content is 81 bytes larger than advertised in the Content-Length header.
I observed no change in behaviour after adding the ob_clean() call into my header file.
OTHERWISE, things work fine.
What's the deal? Is Apache silently adding CRLF's?
I am NOT using the gzhandler or transparent compression here. This is just straightforward output.
=Lord Apollyon=
Reproduce code:
---------------
The code for all of my index.php's consist of the following:
<?PHP
include_once 'db_header.inc';
................
include_once 'db_footer.inc';
?>
db_header.inc:
<?php
$start_time=gettimeofday();
ob_clean(); // paranoid and desperate
ob_start();
header("Connection-Type: Keep-Alive");
?>
db_footer.inc contains:
<?PHP
if ($LOGGING)
{
$LOG->close();
$LOGGING=FALSE;
}
header('Content-Length: ' . ob_get_length());
ob_end_flush();
?>
Note: there are no blank lines at the beginning of my *.inc or *.php files.
Expected result:
----------------
I would expect Content-Length to reflect the actual output size.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 21:00:01 2025 UTC |
try this script: <?php ob_start(); ?> foo <?php header("Connection-Type: Keep-Alive"); header('Content-Length: ' . ob_get_length()); ob_end_flush(); echo ob_get_length(); ?> And access it with this command: # lynx -head lynx -dump -head http://localhost/test.php I get this (correct) output: HTTP/1.1 200 OK Date: Thu, 21 Aug 2003 03:52:44 GMT Server: Apache/1.3.27 (Unix) PHP/4.3.3RC5-dev X-Powered-By: PHP/4.3.3RC5-dev Connection-Type: Keep-Alive Content-Length: 4 Connection: close Content-Type: text/html