For experimental and educational purposes, I am creating an extremely small and simple web server using only netcat.
currently i have
HTTP_RESPONSE="HTTP/1.1 200 OK\n\n Hello"
{ echo -ne "$HTTP_RESPONSE"; } | nc -l -p 8080
What works correctly. However, suppose instead of "Hello" I wanted to send the nc output? Which returns the request header "Get, Host, etc." How could I do this in the same connection, in the same command?
I researched a lot but didn't get a satisfactory answer, almost all involve using nc a second time.