in reply to STDIN and Browsers

First of all a browser sends CONTENT_LENGTH header to a server, so you can do not read anything if it's value too big for you. Anyway if you deside to stop sending you can just close STDIN, or exit.

You could use CGI and it will do it for you if you set up $CGI::POST_MAX variable

An example:

print <<"HTML" and exit if $ENV{CONTENT_LENGTH} > 10000; Content-type: text/plain Error: the file is too big HTML

upd: misprint fixed