These functions previously operated on the assumption that fgetc() would
block; however it will not block on HttpServer streams because those are
non-blocking. They now check error conditions properly before failing
prematurely.
Two ways this is more secure:
1. The seed is only generated once, not every time the function is called.
2. All threads share the same seed, which means timing attacks aren't
possible.
Because we are using a mutex, performance may suffer slightly.
This makes it much more flexible, at the expense of making it a little
more fragile. I can think of a number of scenarios where we'll have
paths that have variables in multiple spots, and I don't want to do
sprintf() magic every time I need to access an object at one of those
paths.
This also makes UtilGetDelim() and UtilGetLine() thread safe in that it
isn't setting a global errno. Of course, errno should be thread safe
already, but this makes it much less ambiguous.