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
The tests you wrote looks not accurate. HTTP requires `"\r\n"` as far as I remember.