Bug 46449 - Output out of order from SSI include virtual
Summary: Output out of order from SSI include virtual
Status: RESOLVED LATER
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_include (show other bugs)
Version: 2.2.9
Hardware: PC Linux
: P2 major with 3 votes (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: MassUpdate
Depends on:
Blocks:
 
Reported: 2008-12-30 03:36 UTC by Leandro Navarro
Modified: 2018-11-07 21:09 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leandro Navarro 2008-12-30 03:36:52 UTC
With the following files:
$ cat test.shtml 
<p>first</p>
<!--#include virtual="test.php"-->
$ cat test.php 
<?php
echo "<p>second</p>";
?>

A request for http://host/test.shtml produces the following erroneous result:
GET /test.shtml HTTP/1.1
Host: www.xxxxxxx.org

HTTP/1.1 200 OK
Date: Tue, 30 Dec 2008 11:21:00 GMT
Server: Apache DAV/2 mod_python/3.3.1 Python/2.5.2
Accept-Ranges: bytes
Transfer-Encoding: chunked
Content-Type: text/html

d
<p>second</p>
e
<p>first</p>


0
An on the browser:

second

first


Our configuration:
 /usr/sbin/apache2 -V
Server version: Apache/2.2.9 (Debian)
Server built:   Oct  1 2008 14:34:07
Server's Module Magic Number: 20051115:15
Server loaded:  APR 1.2.12, APR-Util 1.2.12
Compiled using: APR 1.2.12, APR-Util 1.2.12
Architecture:   64-bit
Server MPM:     Worker
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/worker"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT=""
 -D SUEXEC_BIN="/usr/lib/apache2/suexec"
 -D DEFAULT_PIDLOG="/var/run/apache2.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="/etc/apache2/mime.types"
 -D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf"
Comment 1 Stefan Fritsch 2008-12-30 10:09:50 UTC
It works correctly with mpm-prefork and mod_php.

In what way do you call the php interpreter? Do you have any special output filters configured? What is the output of apache2ctl -M?
Comment 2 Leandro Navarro 2008-12-30 11:16:50 UTC
(In reply to comment #1)
> It works correctly with mpm-prefork and mod_php.
> 
> In what way do you call the php interpreter?
Fast-cgi, with suexec.

AddType application/x-httpd-php .php3 .phtml .php .phps
SuexecUserGroup user group
Action php-fcgi /fcgi-bin/php-fcgi-wrapper
Alias /fcgi-bin/ /home/httpd/fcgi-bin.d/php5-user/

/home/httpd/fcgi-bin.d/php5-user$ more php-fcgi-wrapper 
#!/bin/sh
export PHPRC=/etc/php5/cgi
exec /usr/bin/php5-cgi

> Do you have any special output filters configured? 
Only includes:
mods-enabled/mime.conf:AddOutputFilter INCLUDES .shtml

> What is the output of apache2ctl -M?

/usr/sbin/apache2ctl -M
[Tue Dec 30 19:38:35 2008] [warn] worker http://xxx.yyyyyyy.org already used by another worker
[Tue Dec 30 19:38:36 2008] [warn] worker http://www.xxxxxxxx.org/~zzzz already used by another worker
Loaded Modules:
 core_module (static)
 log_config_module (static)
 logio_module (static)
 mpm_worker_module (static)
 http_module (static)
 so_module (static)
 actions_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 auth_pam_module (shared)
 authn_file_module (shared)
 authz_default_module (shared)
 authz_groupfile_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 cgid_module (shared)
 dav_module (shared)
 dir_module (shared)
 env_module (shared)
 fcgid_module (shared)
 headers_module (shared)
 include_module (shared)
 mime_module (shared)
 security2_module (shared)
 negotiation_module (shared)
 proxy_module (shared)
 proxy_http_module (shared)
 python_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 ssl_module (shared)
 status_module (shared)
 suexec_module (shared)
 unique_id_module (shared)
 userdir_module (shared)
Syntax OK

Comment 3 Leandro Navarro 2009-01-28 13:14:45 UTC
Looking at the code for mod_include, I think that the problem seems to be with ap_sub_req_lookup_uri(), that the output is not flushed before this call is invoked and therefore the output is garbled.

I found this mail related:
http://mail-archives.apache.org/mod_mbox/httpd-dev/200009.mbox/raw/%3C20000913192658.L23617@lyra.org%3E/

If that is the source of the problem, how can I modify mod_include to flush the output before a sub_req is invoked? The code is not that readable to see clearly how to modify.

Any suggestion?

Best regards, Leandro.(In reply to comment #2)
Comment 4 William A. Rowe Jr. 2018-11-07 21:09:25 UTC
Please help us to refine our list of open and current defects; this is a mass update of old and inactive Bugzilla reports which reflect user error, already resolved defects, and still-existing defects in httpd.

As repeatedly announced, the Apache HTTP Server Project has discontinued all development and patch review of the 2.2.x series of releases. The final release 2.2.34 was published in July 2017, and no further evaluation of bug reports or security risks will be considered or published for 2.2.x releases. All reports older than 2.4.x have been updated to status RESOLVED/LATER; no further action is expected unless the report still applies to a current version of httpd.

If your report represented a question or confusion about how to use an httpd feature, an unexpected server behavior, problems building or installing httpd, or working with an external component (a third party module, browser etc.) we ask you to start by bringing your question to the User Support and Discussion mailing list, see [https://httpd.apache.org/lists.html#http-users] for details. Include a link to this Bugzilla report for completeness with your question.

If your report was clearly a defect in httpd or a feature request, we ask that you retest using a modern httpd release (2.4.33 or later) released in the past year. If it can be reproduced, please reopen this bug and change the Version field above to the httpd version you have reconfirmed with.

Your help in identifying defects or enhancements still applicable to the current httpd server software release is greatly appreciated.