Bug 82985 - Content-length miscalculated when using ssi include virtual with wrapped cgi
Summary: Content-length miscalculated when using ssi include virtual with wrapped cgi
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: httpd
Version: 8.0
Hardware: i586
OS: Linux
Target Milestone: ---
Assignee: Joe Orton
QA Contact: Brian Brock
URL: http://nagoya.apache.org/bugzilla/sho...
: 82986 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2003-01-29 10:17 UTC by Jelmer Jellema
Modified: 2007-04-18 16:50 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2003-09-04 07:40:20 UTC

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2003:240 0 normal SHIPPED_LIVE : Updated httpd packages fix Apache security vulnerabilities 2003-09-04 04:00:00 UTC

Description Jelmer Jellema 2003-01-29 10:17:16 UTC
This is a resend of the bug I posted to the apache bugzilla. (See url).

They suggested I tried apache 2.0.44, which is not available for Redhat yet. 
(rpm's have dependencie problems, I did not do a compile).

In short: 

When you use <--#include virtual="blah.cgi" --> in an ssi page, 
and apache runs a cgi-wrapper instead of the default cgi-script handler, the 
Content-length header of the rendered page will be set to the content length 
of the output of the script that was included + the length of the static 
content in the shtml file *up to* the include virtual element.

So browsers that use the Content-length header truncate the output after the 
output of the script. This is even more severe when you include more than one 
cgi in the above way. The Content-length will still be the output length of 
the *first* script + static content before that one. It looks like this is 
another problem of the mod_include filter that calculates content-length.


1. I use Redhat 8.0, standard install, httpd now 2.0.40-11. (I tried to 
install 2.0.43 thru an rpm, but this did not work because of dependencies).

2. Create a fake cgi-wrapper, that does nothing but run the script. I'll 
attach a file called testwrap, in perl code. It runs the script and logs the 
size in bytes to a file in /tmp. Asume this is 
in /usr/local/testwrapper/testwrap and executable for apache.

3. Make sure Includes are used, I used this globaly in httpd.conf:
AddType text/html .shtml .shtm
AddOutputFilter INCLUDES .shtm .shtml .htm .html
Options +Includes
AcceptPathInfo On

4. Make sure all .cgi gets handled by the testwrap script from step 2. I used 
this in a virtual host:

ScriptAlias /testwrapper/ /usr/local/testwrapper/
AddHandler test_wrapper .cgi .pl
Action test_wrapper /testwrapper/testwrap

5. Reload the server etc.

6. In the documentroot of the virtual host, I created a test.shtml, test1.cgi 
and test2.cgi. test.shtml does an include virtual of test1.cgi (that outputs a 
header + 100 bytes) and test2.cgi (header + 500 bytes). All files readable and 
the cgi scripts executable for apache.

7. Internet explorer en netscape only show the page up to and including the 
first script. wget -O - (url) will show that the content-length header is 
wrong, but will still get the whole file, showing that everything runs fine.

Comment 1 Jelmer Jellema 2003-01-29 10:22:35 UTC
*** Bug 82986 has been marked as a duplicate of this bug. ***

Comment 2 Jelmer Jellema 2003-01-29 10:25:20 UTC
I tried to attach the files mentioned in the bugreport, but there seems to be 
a problem with that page (I can fill in the form but when commited, I get an 
Please see http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16498
you will find the attachments there.

Comment 3 Joe Orton 2003-07-30 14:13:59 UTC
Thanks for the report, the fix is being incorporated for a forthcoming erratum.

Comment 4 Mark J. Cox 2003-09-04 07:40:20 UTC
An errata has been issued which should help the problem described in this bug report. 
This report is therefore being closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, please follow the link below. You may reopen 
this bug report if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.