manish.rathi has asked for the wisdom of the Perl Monks concerning the following question:

When a request is received by the server for CGI, the parameters it receives are through QUERY_STRING environment variable. So QUERY_STRING is the environment variable for a server and when a request is received for CGI, this variable holds the string that comes with that request.

Now, if a second request comes in with different set of parameters and same QUERY_STRING is holding the new values, then string that came with first requst will be lost.

Like this , if many request keep coming in, new threads will be opened up to handle each request. But how will all these threads be supplied string values that came with that particular request because QUERY_STRING will be holding the values that came with the last request ?

For some other variables, multiple requests dont make differece because they have same value for all the request e.g. server info. This issue is only for request specific variables like QUERY_STRING

  • Comment on QUERY_STRING environment variable for CGI

Replies are listed 'Best First'.
Re: QUERY_STRING environment variable for CGI
by cosmicperl (Chaplain) on Mar 11, 2009 at 23:43 UTC
    With CGI you get a separate process for each request. So they each have their own ENV with QUERY_STRING and all the other variables. They do not effect each others variables.


    Lyle
      After all, CGI is designed as an inter-process communication scheme, using the environment, STDIN and STDOUT as channels.
Re: QUERY_STRING environment variable for CGI
by wfsp (Abbot) on Mar 12, 2009 at 08:44 UTC