Subject: Re: IIS, CGI, and GCC
From: [email-masked] (Dylan Griffiths)

12 Jun 1998 02:33:21 -0700
Message-ID: <[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
To: "Chieh Cheng" <[email-masked]>,
        "Gnu Win32 Mailing list" <[email-masked]>

-----Original Message-----
From: Chieh Cheng <[email-masked]>
To: [email-masked] <[email-masked]>
Date: Thursday 11, June, 1998 20:56
Subject: IIS, CGI, and GCC

>I have a problem with a CGI program compiled with GCC and ran under IIS. My
>problem is the exact same problem as the problem listed in the archive at:
>http://www.cygnus.com/ml/gnu-win32/1997-Oct/0293.html

>  fprintf (stdout, "Content-Type: text/html");
>  fprintf (stdout, EOL);
>  fprintf (stdout, EOL);
>
>  fprintf (stdout,
"<html><head><title>whatever</title></head><body><pre>");
>  fprintf (stdout, EOL);

Now, that looks OK.. Especially since I sat down and wrote a CGI program
that takes input from a page and turns it into an email to be sent through
my server (took me 6 hours, and it works great).  I'm using the program with
Xitami, not IIS (which is way too bloated).  The code for the page is as
follows:

int main(int argc, char *argv[])
{
   size_t content_length;
   int x;
   FILE *fp;

   if(strcmp(getenv("REQUEST_METHOD"), "POST"))
   {
      printf("Content-Type: text/html\n\n");  /* This could be the problem
solver */
      puts("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">");
      puts("<head><title>CGI error</title></head><body>");
      puts("This script should be referenced with a METHOD of POST.\n");
      puts("If you don't understand this, see this ");
      puts("<A
HREF=\"http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/fill-out-forms/over
view.html\">forms overview</A>.\n");
      puts("</body></html>");
      exit(1);
   }

There's more code, but this shows you the important pieces.  If IIS won't
run it even after you have the headers setup correctly, then it must be a
problem with IIS.. Try it with something like Xitami (www.imatix.com).. It's
only a meg or so to download and there is public source code to examine,
too.  The code itself has been ported to almost every OS.

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".