Search code examples
c++httpboostproxyboost-asio

HTTP requests via proxy with boost beast


Is it possible to set a proxy when making HTTP requests using Boost Beast? Using CURL is straighforward. Anyone has done this? Thank you,


Solution

  • Depends on the kind of proxy. There's a socks4 sample in the Asio library distribution (asio/example/cpp{03,11}/socks4).

    I've written a socks4 client (sync/async) on here: socks4 with asynchronous boost::asio.

    More recently I extended that for socks5: Is there a native support for proxy connection via socks5 for boost::asio?

    Which I also put on github: https://github.com/sehe/asio-socks45-client. I intend to take some time to rework them at least adding basic authentication. They might get added to the Beast libraries.