Forum

CGI times out while waiting for input from POST

bleb
29 March 2018, 18:10
I have a CGI script which runs cat to get the payload for a POST request. When there is no payload (the only case I've tested), cat stalls, as if it were invoked from the command line. Not sure if it's in the CGI standard, but it seems all other web servers send an EOF when there is no POST payload.

On the off chance that this is WAI, how would you suggest I work around this?
Hugo Leisink
30 March 2018, 00:24
Check the CONTENT_LENGTH environment variable. If it is 0, don't read for content.
bleb
31 March 2018, 16:45
Does the CGI spec say not to send EOF when there is no content?
Hugo Leisink
31 March 2018, 19:59
Not that I'm aware of. The CGI specification is vague anyway.
This topic has been closed.