in reply to HTTP request

You are reinventing the wheel.

If you insist on doing that, fine... but you'll have to learn a lot of details you could otherwise ignore.

One detail you'll have to learn about HTTP 1.1 is that a Host header is required. Not sending it should return a Bad Request rather than a Not Found though, so I'm not sure that's your problem.

-sauoq
"My two cents aren't worth a dime.";