added proper support for connection: close, optimized header parsing