From: Rob McCool <robm@netscape.com>
Newsgroups: netscape.devs-nsapi
Subject: Re: HELP: CGI env var problem
Date: Wed, 23 Oct 1996 18:30:57 -0700

> Help please, I am baffled.
> 
> I have an NSAPI function that sets an environment variable
> for a CGI program like so:
>     param_free( pblock_remove( "somevar", rq->headers ) );
>     pblock_nvinsert( "somevar", "somevalue", rq->headers );
> The CGI program is able to access it as HTTP_SOMEVAR just fine.
> 
> Problem is, HTTP_SOMEVAR and its value show up in the
> environment of *EVERY* CGI program that gets executed afterwards,
> even the ones that *do not* go through the NSAPI routine that sets
> the rq->headers.  I thought the environment variable should only
> be set for the *one* CGI program for which I send the header.
> 
> This is happening on WinNT Communications Server 1.13, but I don't
> have access to another server or platform to test more.  The only
> way I have found to clear the variable is to stop and restart the
> server, but I'm stuck again after the next time my NSAPI function
> is called.
> 
> Can anyone out there verify-disprove-explain this behavior?

This is a known problem in the 1.x NT servers. The 2.x servers fix this problem. A workaround is to insert a blank string for HTTP_SOMEVAR (i.e. pblock_nvinsert("somevar", "", rq->headers) when you don't plan to have a value for HTTP_SOMEVAR.

-- Rob McCool, robm@netscape.com http://home.netscape.com/people/robm/ Stunt Programmer, Netscape Communications Corporation It was working ten minutes ago, I swear...

Reproduced by permission of the author.