Question

I would like to implement and HTTP proxy server to get a deeper understanding of some of the finer points of the protocol and learn some socket programming along the way but I don't want to implement a full-blown HTTP server. What are the relevant RFC pages and sections in those pages that I should be focusing on if I just want to implement a proxy?

The plan is to start with a regular HTTP proxy and then potentially extend it to an HTTPS proxy.

Was it helpful?

OTHER TIPS

I'm currently working on it too. The basic implementation is simple. Listen on a socket port, find the host, connect to remote server, send http header, recv from server, then send back to client. The difficult part is consistent connection and pipelining.

As to HTTPs, its header is like this:

CONNECT addons.mozilla.org:443 HTTP/1.1
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0
Host: addons.mozilla.org

Proxy should connect to server, then reply to client a 200 message, then redirect back and forth as a redirector.

Check this: http://tools.ietf.org/html/draft-luotonen-ssl-tunneling-03

You might also find the work of the HTTPbis group in the IETF helpful; we're re-writing the specs to make them more clear and easier to implement.

See http://trac.tools.ietf.org/wg/httpbis/trac/wiki for more information.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top