php.net |  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: bfrance@php.net Assigned:
Status: Closed Package: Apache2 related
PHP Version: 5.3.1 OS:
Private report: No CVE-ID:
 [2010-02-05 18:27 UTC] bfrance@php.net
Description:
------------
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:

http://www.brianfrance.com/software/php/sapi_content_length.txt

Let me know if you have any questions.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-05 18:59 UTC] svn@php.net
Automatic comment from SVN on behalf of rasmus
Revision: http://svn.php.net/viewvc/?view=revision&revision=294571
Log: Fix bug #50940
 [2010-02-05 18:59 UTC] rasmus@php.net
Patch applied to all branches.
 [2010-02-05 19:34 UTC] svn@php.net
Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revision&revision=294572
Log: - Fix bug #50940
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Mon Apr 21 07:02:06 2014 UTC