First
Your request have to match HTTP protocol.
IE your header have to be terminated by an empty line:
GET /index.html HTTP/1.1
Host foo.com:80
Nota: Each line have to teminate by CRLF, not only LF nor only CR:
00000000 47 45 54 20 2f 20 48 54 54 50 2f 31 2e 30 5c 72 |GET / HTTP/1.0\r|
00000010 5c 6e 48 6f 73 74 3a 20 66 6f 6f 2e 63 6f 6d 3a |\nHost: foo.com:|
00000020 38 30 5c 72 5c 6e 5c 72 5c 6e 0a |80\r\n\r\n.|
The server's answer could match same form:
Header - Empty line - Body
So you could drop the header by using sed, for sample:
nc foo.com 80 <<<$'GET / HTTP/1.0\r\nHost: foo.com:80\r\n\r' |
sed '1,/^\r\?$/d' > index-of-foo.com.html
Or dump only the header:
nc foo.com 80 <<<$'GET / HTTP/1.0\r\nHost: foo.com:80\r\n\r' |
sed '/^\r\?$/q'
You could find all your answer on Internet:
First referencial doc: on w3.org
Or at Wikipedia: http on wikipedia
What a method for answering?
The header of answer do contain all needed information for understanding how to deal with answer.
Essentialy, there is a Content-Type, required to tell your browser what to do with that.
The server could have to process some stuff for building his answer, but between server and client, there are only one (stupid) TCP connection.
There is nothing the server could ask the client to do...
Except interactive constructions between high level processing stack like javascript, html5 (css), java, flash or other dilbertlight.