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:


<script>
var delay = 3;
var calls = 0;

function maybe_refresh() {

  if ( !document.images ) return;

  if ( calls > 0 ) {
    window.location.reload();
  }
  else {
    calls += 1;
    setTimeout( 'maybe_refresh()', delay * 1000 );
  }
}

window.onload = maybe_refresh;
</script>


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).


So I'm completely stumped, and would very much welcome any ideas you may
have for troubleshooting this.

For one thing I'd like to find out if the problem is with Apache or with
Firefox.  My hope is that there is some configuration for Apache that will
cause Firefox to behave the same way that Safari does.

Many thanks in advance!

Kynnjo

Reply via email to