LPM: CGI question

Janine janine at emazing.com
Tue Jan 16 15:29:26 CST 2001


Thanks, Joe.  That helped a lot.  :-)

Janine

> -----Original Message-----
> From: owner-lexington-pm-list at pm.org
> [mailto:owner-lexington-pm-list at pm.org]On Behalf Of Joe Hourcle
> Sent: Thursday, January 11, 2001 5:05 PM
> To: lexington-pm-list at happyfunball.pm.org
> Subject: Re: LPM: CGI question
> 
> 
> 
> 
> On Thu, 11 Jan 2001, Janine wrote:
> 
> > I'm trying to figure out the best way of telling whether a script was
> > invoked through a browser or from the command line.  Right now I'm
> > checking if ENV{"HTTP_HOST"} exists (yes = browser; no = command
> > line).  Does anyone know of a better way to do this?
> 
> Technically, HTTP_HOST is set only by browsers which support software
> virtual hosts.  [As first generation browsers don't send a Host: header]
> 
> Unless you know your server will set HTTP_HOST to null if they don't send
> the header [mine won't -- an old Netscape Enterprise 3.0 server], you'd be
> better off checking something that's more likely to be there:
> 
> 	REMOTE_ADDR
> 	REQUEST_METHOD
> 	SERVER_NAME
> 	SERVER_PROTOCOL
> 
> Personally, I go with REMOTE_ADDR, as it's needed for the web server to
> reply back to the browser.
> 
> -----
> Joe Hourcle
> 
> 



More information about the Lexington-pm mailing list