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
Replacing `return;` with `break;` changes nothing because nothing happens after the loop. I'd better use `break;` though for the case someone adds some code after the loop.