I'm making a web application fuzzer and for my proxy server, I'm using opensource code (for now) developed by a guy named Alex Ott. I've noticed though that when I make requests from some websites that those don't get captured so I really want to write my own proxy in C++ but I have absolutely no idea where to start. Could someone explain it to me?
The end goal is really to be able to capture and write every request that comes through the proxy to a file, which I'm already doing but the proxy server I have now isn't catch all this requests, ones I know to be there.
Edit: Since the question was unclear, here it is: I want to know what the code is for a proxy server written in C++ using the Boost extension libraries. Same question for the past four months.
Well, here's a somewhat functional example to get you started. It forwards between two connections. Note that this simple example won't work for a web browser, as the client will attempt to make several connections, and this example only listens on one. Using this as a (very simple) base, you should be able to make some progress.
The interesting stuff happens in
handle_read
, which is the callback that is executed when data is received. This function forwards the data between sockets. Notice that when we originally called it for the "local" and "remote" connections that the order we passed the sockets in is reversed (read_from
andwrite_to
).