How does a stack know it's been opened from a cgi?

Ken Ray kray at sonsothunder.com
Wed Feb 8 13:10:39 EST 2006


On 2/8/06 11:58 AM, "Trevor DeVore" <lists at mangomultimedia.com> wrote:

> On Feb 8, 2006, at 9:06 AM, Ken Ray wrote:
> 
>> Hi, I have a library that I want my CGI to 'start using', but it is
>> important that the library know whether it is being loaded from a
>> CGI, or
>> whether it's being loaded from a "normal" stack.
>> 
>> What can a stack do to test whether it's being loaded from a CGI or
>> not?
> 
> I wonder if there are any extra global vars set (environmental
> variables) when running as CGI?  Perhaps check that list and see if
> there are HTTP specific ones.

Yup, that did it... there's a whole slew of globals that don't exist when
running in a "normal" stack. I'm picking "$HTTP_HOST" to check for, since
it's likely that will always be in "the globals".

Thanks, Trevor!


Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list