fix the location of HTTP Connection Header

'Connection: close' was appended after '\r\n\r\n'. So I fix that it is
before '\r\n\r\n'.
Also, remove duplicated Connection header in case that a client sends
Connection header.
robustly receive HTTP content body for buggy clients
reduce possible unnecessary packet division. send long data more reliably
Merge pull request #7 from peecky/master

some bug fix and optimization