Bug 16498 - SSI Content-length calculated on first included (wrapped) cgi only
Summary: SSI Content-length calculated on first included (wrapped) cgi only
Status: CLOSED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_include (show other bugs)
Version: 2.0.40
Hardware: PC Linux
: P3 major (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-28 16:47 UTC by Jelmer Jellema
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments
testwrap file (see description) (283 bytes, text/plain)
2003-01-28 16:50 UTC, Jelmer Jellema
Details
test.shtml file (see description) (191 bytes, text/html)
2003-01-28 16:52 UTC, Jelmer Jellema
Details
test1.cgi (see bug description) (128 bytes, text/plain)
2003-01-28 16:56 UTC, Jelmer Jellema
Details
test2.cgi (see bug description) (129 bytes, text/plain)
2003-01-28 16:56 UTC, Jelmer Jellema
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jelmer Jellema 2003-01-28 16:47:51 UTC
This looks a bit like bug # 7666 (closed)

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 or the same problem with timing of the filter as bug 7666??

Reproduce:

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.

I hope I just did something wrong, in which case my appologies.
Comment 1 Jelmer Jellema 2003-01-28 16:50:38 UTC
Created attachment 4588 [details]
testwrap file (see description)
Comment 2 Jelmer Jellema 2003-01-28 16:52:06 UTC
Created attachment 4589 [details]
test.shtml file (see description)
Comment 3 Jelmer Jellema 2003-01-28 16:56:16 UTC
Created attachment 4590 [details]
test1.cgi (see bug description)
Comment 4 Jelmer Jellema 2003-01-28 16:56:45 UTC
Created attachment 4591 [details]
test2.cgi (see bug description)
Comment 5 Joshua Slive 2003-01-28 17:39:28 UTC
I understand you have a problem with upgrading, but it is unlikely that
Apache developers are going to want to work on a problem with a release
that is several versions out of date.

If you can't upgrade for some Redhat-related reason, you may want to report this
in Redhat's bug tracking database.
Comment 6 Jelmer Jellema 2003-01-28 17:50:19 UTC
Well, I díd check the changelogs from 2.0.40 up to see if something like this 
was fixed.... I did not find it. Maybe someone could at least tell wether this 
was fixed or not?

For the rest, this is my testserver, so I could do without this for a while. 
Just trying to be helpful...
Comment 7 Joshua Slive 2003-01-28 21:29:15 UTC
There were several rixes related to the content-length filter.  I would think
that it should be just getting out of the way and not returning a content-length
in this case.  But I can't say for sure whether this problem was fixed.

The easiest way is to try.
Comment 8 Jelmer Jellema 2003-02-02 12:47:30 UTC
This bug seems to be sort-of fixed in 2.0.44, but problems still exists in the 
way the cgi-output is included. See my new bug report 16673.
Comment 9 Joshua Slive 2003-02-03 20:56:42 UTC
Mark this as fixed.  Further tracking in bug 16673.