POST method

Skip Montanaro (
Wed, 25 Sep 1996 19:07:57 -0400

Date: Wed, 25 Sep 1996 19:07:57 -0400
From: Skip Montanaro <>
Message-Id: <>
To: Michael Vargo <>
Subject: POST method
In-Reply-To: <>

   Has anyone successfully gotten the POST method to work?
           //fgets (buff, 5120, stdin);
           gets (buff);


   It always gives me an empty string no matter what I send to stdin...
   If I use the fgets it works.

Hmmm... I can't offer an explanation why fgets would work and gets wouldn't,
but shouldn't you be evaluating the Content-Length header and then reading
that many bytes from stdin?

	char *buff;
	length = ... whatever it takes ... ;
	buff = malloc(length)
	... check buff ...
	fread(buff, length, 1, stdin);
	... do your thang with buff ...

Also, if the input can contain raw binary data (it can now with the Xerox
file upload stuff, right?), strdup, fgets and gets wouldn't work since they
all stop at NULLs.

Skip Montanaro     |   Musi-Cal:  |   Conference Calendar:
(518)372-5583      |   Python: