POST method

Skip Montanaro (skip@automatrix.com)
Wed, 25 Sep 1996 19:07:57 -0400

Date: Wed, 25 Sep 1996 19:07:57 -0400
From: Skip Montanaro <skip@automatrix.com>
Message-Id: <199609252307.TAA04778@dolphin.automatrix.com>
To: Michael Vargo <mvarg@ctp.com>
Subject: POST method
In-Reply-To: <01BBAACF.9A26B200@cubehead.la.ctp.com>


   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 ...
	free(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: http://concerts.calendar.com/
skip@calendar.com  |   Conference Calendar: http://conferences.calendar.com/
(518)372-5583      |   Python: http://www.python.org/