I am trying to debug a large Perl/CGI-based legacy system that is not working right on some browsers, like Firefox 3. It runs on an Ubuntu host with Apache 2.2.3.
I reduced the problem to a very simple case, in the form of a short Perl CGI script. This script has the following logical structure (in pseudo code):
if called without session ID
create new session id
use this id to cache a data stub (with "expect-more-data" flag set)
fork
if parent
respond with a 302 redirect whose URL is the script URL + the session ID
exit
if child
repeat for i in 1..20
sleep 1 second
add "i\n" to the cached data
unset the "expect-more-data" flag in the cached data object
exit
else (i.e. session ID available)
retrieve cached data
if "expect-more-data" flag is set
add "...continuing..." at the end of the response
add <meta http-equiv="refresh" content="3"/> to the response's header
display a page with the newly retrieved data
This works fine with Safari, but with Firefox (v. 3), the browser appears to be loading for about 20 seconds and then in the end it displays only the last page; none of the intermediate update pages is displayed.
If one looks at Apache's access logs, when the request is done via Safari, one sees several GET requests logged, right in synch with the page updates as they're being displayed by the browser, as expected. But when one uses Firefox, the access log show only two GET requests, the very first one and the very last one, and they both appear simultaneously when the last (and only) page is finally displayed. (The error logs do not register any messages during this time.)
It was as if the initial request from Firefox was not deemed finalized until the very last one was...
I thought that perhaps for some reason Firefox was simply dropping all the responses that had a <meta http-equiv="refresh" .../> directive in the header. So I decided to implement the same server-browser interaction using _javascript_; i.e. I replaced the <meta http-equiv="refresh" .../> tag with the following bit of _javascript_:
Strangely enough, when I did this the observed behavior was exactly the same as before: the new script works fine with Safari, but not with Firefox.
This pretty much blows my best explanation out of the water. In other words, although it may be minimally plausible that Firefox would be disregarding all the responses from the server that have a <meta http-equiv="refresh".../> tag in them, I don't see how on earth Firefox could reject all those that have the _javascript_ snippet shown above, without also rejecting all pages that have embedded _javascript_ (which definitely does not happen in this case).