The request needs to be read and send in binary mode in order to use CRLF instead of LF. Adding --upload-file - causes curl to read stdin in binary mode.
Add simple telnet tests which (ab)use the http server. The second test checks for an input file handling bug.