Recent SSI glitch when calling CGI function

software development

#1

(DH Support has no answers at this time other than to check the forums.)

Problem: SSI code calling CGI function repeats the entire page at point of include and then executes said function (see http://treesfoundation.org)

We ran a couple of tests to see if it was SSI alone, or CGI alone, or SSI plus CGI and have found the problem replicates itself perfectly in combination.

http://treesfoundation.org/_index_2.shtml (SSI pulling static HTML snippet, working fine)
http://treesfoundation.org/_index_3.shtml (SSI calling CGI function – doubling the page it’s on and then executing)
http://treesfoundation.org/cgi-priv/News...n=homepage (CGI alone, working fine)

Now the weird thing is, we’ve had the same code running without a glitch since around 2000 (yes, yes, the site is awfully archaic).

At some point in the last couple of weeks it stopped working (we just noticed it two days ago).

This leads us to question whether or not perhaps something was updated on the server… ?

If anyone else has experienced this or has something we could try, please let us know!

THANKS.


#2

Anything in the error logs?

I haven’t seen the problem you describe, however, in the past when I had trouble with an #include virtual="./x.cgi", I made a shim PHP script to replace it – a kludge, but it worked:

#include virtual="./x.php"

x.php:

<?PHP readfile("http://example.com/x.cgi"); ?>

#3

Thanks so much for taking the time to respond. :slight_smile:

LOGS: When accessing “http://treesfoundation.org/_index_3.shtml” it seems
that the request is loaded twice:

67.205.61.46 - - [05/May/2011:15:29:39 -0700] “GET /_index_3.shtml
HTTP/1.1” 200 5047 “-” "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7)
AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.57 Safari/534.24"
208.80.64.174 - - [05/May/2011:15:29:39 -0700] “GET /_index_3.shtml
HTTP/1.1” 200 5533 “-” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7)
AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.57 Safari/534.24”

The 2nd IP is our webserver address.

When the script itself is loaded, it does the same thing:

67.205.61.46 - - [05/May/2011:15:35:06 -0700] “GET
/cgi-priv/News.pl?function=homepage HTTP/1.1” 200 4648 “-” "Mozilla/5.0
(Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.24 (KHTML, like Gecko)
Chrome/11.0.696.57 Safari/534.24"
208.80.64.174 - - [05/May/2011:15:35:06 -0700] “GET
/cgi-priv/News.pl?function=homepage HTTP/1.1” 200 1560 “-” “Mozilla/5.0
(Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.24 (KHTML, like Gecko)
Chrome/11.0.696.57 Safari/534.24”

When I the static HTML is loaded (through SSI), it only gets one hit:

208.80.64.174 - - [05/May/2011:15:45:48 -0700] “GET /_index_2.shtml
HTTP/1.1” 200 5043 “-” “Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7;
en-us) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5
Safari/533.21.1”


#4

Those double-hits are very strange. You’re using include-virtual right? Something like:

On my site, I have something similar, but I do not see the virtual hits from the web-server – I only see hits from the remote client. This is correct SSI behavior, since it is a “virtual” page request, not a real one.

The strangest thing is that your News.pl is producing double hits. Just to confirm: You see the double hits on News.pl when you just access the News URL in your browser, right? i.e.:

http://treesfoundation.org/cgi-priv/News.pl?function=homepage

Does News.pl do some sort of recursive HTTP get call? Otherwise, I can’t think of an explanation. It is also strange that the size of the two hits is different.

You might try creating a simple “hello world” CGI script, and test to see if the causes double-hits and SSI problems.


#5

Yes, that’s the exact include code we’re using.

I’ll try what you suggested and get back with you.