trouble with getenv

Eric Cifreo <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
Hi all,

New to the fastcgi-dev list.  I've been playing with the example
applications today and I'm having trouble gettting getenv() to return
anything.  Some google searches turned up some archived posts from
this list but seemed to suggest that getenv() should work fine as long
as you call it after you call FCGI_Accept().  I've slightly modified
the example to look like this:

#include "fcgi_stdio.h" 
#include <stdlib.h>
#include "fcgiapp.h"

int count;

void initialize(void)
{
  count=0;
}

void main(void)
{
  
  initialize();

  while (FCGI_Accept() >= 0)   {
  char* host = getenv( "SERVER_HOSTNAME" );

  if( !host)
	  host = "getenv failed";

    printf("Content-type: text/html\r\n"
           "\r\n"
           "<title>FastCGI Hello! (C, fcgi_stdio library)</title>"
           "<h1>FastCGI Hello! (C, fcgi_stdio library)</h1>"
           "Request number %d running on host <i>%s</i>\n",
            ++count, host );
  }

}


So I get the standard output from the example except the hostname
lookup from the environment failed so I get "getenv failed."  I built
the "echo" example as well and when I run it I see this in the
browser:
#########
FastCGI echo
Request number 28, Process ID: 2480

No data from standard input.

Request environment:

SystemRoot=C:\WINNT
_FCGI_SHUTDOWN_EVENT_=1260
_FCGI_MUTEX_=1264

Initial environment:

SystemRoot=C:\WINNT
_FCGI_SHUTDOWN_EVENT_=1260
_FCGI_MUTEX_=1264
#########

Shouldn't there be more in the request environment?

My dev setup is Window 2000 Professional  SP3, MSVC++6 SP6, Apache
2.0.53, mod_fastcgi 2.4.2.

Any solution to what I'm doing wrong here?
Thanks in advance,

--eric
___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.