Fixed infinite loop that takes over the CPU during request handling

* Prevented the infinite loop in HTTP header parser
* Fixed invalid typecasts in GenericConnection
* Fixed typo in the comment
Man pages on `read` say the opposite:
http://man7.org/linux/man-pages/man2/read.2.html#RETURN_VALUE
http://linux.die.net/man/2/read

*(emphasis mine)*
> Return Value
> On success, the number of bytes read is returned **(zero indicates end of file)**, and the file position is advanced by this number. It is not an error if this number is smaller than the number of bytes requested; this may happen for example because fewer bytes are actually available right now (maybe because we were close to end-of-file, or because we are reading from a pipe, or from a terminal), or because read() was interrupted by a signal. On error, -1 is returned, and errno is set appropriately. In this case it is left unspecified whether the file position (if any) changes.

If more data is going to arrive, the `read` call should block and wait for it (unless a non-blocking call is made which is not the case).

My request is performed by the browser's `XMLHttpRequest`, it does these transport things automatically and it does not set `Content-Length`. Anyways, this would be **content** length, so it should not influence the **headers**.