Possible bug in SSI include handling

Maxim Khitrov mkhitrov at gmail.com
Wed Dec 30 22:42:16 MSK 2009

Hello all,

This file structure required to duplicate this bug is a bit complex to
explain. Therefore, I put the required files into a tiny archive,
which you can download from [1].

This problem is appearing in latest 0.7 and 0.8 releases on FreeBSD
7.2. Download the archive, extract it to some directory, and start
nginx with the included configuration file (edit the "root" directive
as needed first). If you then view /good1.html and /good2.html, you
should see the following text:

File Header
Page Header
Page Footer
File Footer

Viewing bad.html will show this:

File Header
Page Header

The last two lines are missing. If you look at the source for all
three files, you'll see where the problem is. Conceptually, they are
all identical, but something breaks when executing the SSI code in
bad.html. More precisely, execution seems to stop after the first
include directive in content_footer.inc. Files good1.html and
good2.html show two ways of fixing the problem, but I cannot find a
good explanation as to why the original file doesn't work as expected.

I started looking through the source code for ssi module, but I'm
hoping that someone more familiar with nginx internals would be able
to find a solution quicker. It seems that adding wait="yes" to the
virtual include in bad.html also fixes the problem, so I suspect that
the issue is with requests being performed in parallel.

- Max

[1] http://www.bhsai.org/downloads/ssi.tgz

More information about the nginx mailing list