php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31197 http header function cannot set content-length
Submitted: 2004-12-20 11:58 UTC Modified: 2004-12-22 14:12 UTC
From: pnewman at wanadoo dot nl Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.3.8 OS: fedora core 2 (linux)
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pnewman at wanadoo dot nl
New email:
PHP Version: OS:

 

 [2004-12-20 11:58 UTC] pnewman at wanadoo dot nl
Description:
------------
Hi

I am scratching my head about this.

Nothing I can do can get the Content-Length to output - I have tried using ob_start to use a buffer inorder to calculate the exact number of characters but even a script this simple does not work?

Regards,
Peter.

Reproduce code:
---------------
<?php
header('Content-Length: 48');
?>
<html>
<body>
<p>hi</p>
</body>
</html>

Expected result:
----------------
HTTP/1.1 200 OK
Date: Mon, 20 Dec 2004 10:56:30 GMT
Server: Apache/2.0.51 (Fedora)
X-Powered-By: PHP/4.3.8
Content-Length: 48
Connection: close
Content-Type: text/html; charset=UTF-8


Actual result:
--------------
lynx -head -dump http://localhost/test3.php returns

HTTP/1.1 200 OK
Date: Mon, 20 Dec 2004 10:54:23 GMT
Server: Apache/2.0.51 (Fedora)
X-Powered-By: PHP/4.3.8
Connection: close
Content-Type: text/html; charset=UTF-8


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-20 12:04 UTC] derick@php.net
Perhaps Apache mangles headers, did you try apache 1? If not, please try it.
 [2004-12-20 12:25 UTC] pnewman at wanadoo dot nl
I can try but we need to use webdav for subversion which requires apache2.

I know that you recommend only apache1 with php but this configuration is default for fedora core 2 and we use mysql which is threadsafe (I assume fedora people have considered how they built apache2/php/mysql carefully?).

If this problem does not occur in apache1 would this be a apache bug and not a php bug?
 [2004-12-20 13:30 UTC] derick@php.net
It's also happening with Apache 1, I could reproduce this.
 [2004-12-20 17:44 UTC] iliaa@php.net
It works fine in Apache 1 and Apache 2 with 4.3.10.
Apache 2 was even intelligent enough to see that the real content length was 39 bytes and not 48 and adjust the header accordingly.
 [2004-12-22 14:12 UTC] derick@php.net
And I was mistaken, I can not reproduce this (I used the wrong vhost to test it).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 07:01:30 2024 UTC