title: Perl CGI gets parameters from a different request to the current URL
body: <p>This is a weird one. :)</p>
  
  <p>I have a script running under Apache 1.3, with Apache::PerlRun option of mod_perl. It uses the standard CGI.pm module. It's a regularly accessed script on a busy server, accessed over https.</p>
  
  <p>The URL is typically something like...</p>
  
  <blockquote>
    <p>/script.pl?action=edit&amp;id=47049</p>
  </blockquote>
  
  <p>Which is then brought into Perl the usual way...</p>
  
  <pre><code>my $action = $cgi-&gt;param("action");
  my $id = $cgi-&gt;param("id");
  </code></pre>
  
  <p>This has been working successfully for a couple of years. However we started getting support requests this week from our customers who were accessing this script and getting blank pages. We already had a line like the following that put the current URL into a form we use for customers to report an issue about a page...</p>
  
  <pre><code>$cgi-&gt;url(-query =&gt; 1);
  </code></pre>
  
  <p>And when we view source of the page, the result of that command is the same URL, but with an entirely different query string.</p>
  
  <blockquote>
    <p>/script.pl?action=login&amp;user=foo&amp;password=bar</p>
  </blockquote>
  
  <p>A query string that we recognise as being from a totally different script elsewhere on our system.</p>
  
  <p>However crazy it sounds, it seems that when users are accessing a URL with a query string, the query string that the script is seeing is one from a previous request on another script. Of course the script can't handle that action and outputs nothing.</p>
  
  <p>We have some automated test scripts running to see how often this happens, and it's not every time. To throw some extra confusion into the mix, after an Apache restart, the problem seems to initially disappear completely only to come back later. So whatever is causing it is somehow relieved by a restart, but we can't see how Apache can possibly take the request from one user and mix it up with another.</p>