|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50940 All Apache SAPI sets content length wrong
Submitted: 2010-02-05 18:27 UTC Modified: 2010-02-05 18:59 UTC
From: Assigned:
Status: Closed Package: Apache2 related
PHP Version: 5.3.1 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
44 + 9 = ?
Subscribe to this entry?

 [2010-02-05 18:27 UTC]
The following SAPI that handle Apache are doing the content length setting wrong:

apache, apache2handler, apache2filter

The problems when you do:

  header("Content-Length: 20");

the SAPI module would just set the header doing a table set on r->headers_out, but not update r->clength.  Instead of doing a table set it should be calling ap_set_content_length, which sets clength and does the table set for you.

I found this in Apache 2.x because we have a filter that appends data to the end of the content.  It uses r->clength and updates with the additionally data value, but it doesn't work correctly if you use the above header PHP call.

The following patch fixes the problem:

Let me know if you have any questions.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-05 18:59 UTC]
Automatic comment from SVN on behalf of rasmus
Log: Fix bug #50940
 [2010-02-05 18:59 UTC]
Patch applied to all branches.
 [2010-02-05 19:34 UTC]
Automatic comment from SVN on behalf of pajoye
Log: - Fix bug #50940
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Mar 02 10:01:28 2024 UTC