I voted --, and wanted to explain why.
Given all of the fuss over handrolled CGI parsers
lately, I am amazed that you would post your own.
chromatic right now has an excellent explanation
of why you really didn't want to do that. (And yes, you did make most of the common mistakes.)
Additionally you don't seem to be aware of a variety of
race conditions, security holes, etc. For a random instance take
a look at this
and figure out how many of the attacks you could be taken
down with. Oh, better than that, how many of the attacks
are designed to get around checks that you don't even do?
Hopefully you will take this as constructive criticism and
learn how to avoid these problems in the future. But in
the meantime -- for bad advice that will put at risk anyone
who follows it.