Okay, I'm creating a small HTTP proxy (not HTTPS...), but I've hit some walls. I've read almost the entire HTTP RFC (Like a million billion pages).
So when I get the client, I chuck it in it's own thread, and I start reading from the socket, but I need to read some headers, "Host:" for example. But how should I go around sending the contents/headers to the server? What's the best way to read the headers? (Until I hit CR LF CR LF), currently I read a buffer of x bytes, resize a larger buffer append the contents of the small buffer and check for CR LF CR LF, Process the header, then directly read from the client and send it to the server, is that the best way?
Sorry if I haven't been clear, basically I'm asking what's the best way to process HTTP headers for a small proxy server (and modify them if I have to, then send them on)?
Thanks in Advance.