This directory contains examples illustrating different modes of use of the cohttp-eio package.
This executable shows an example of how to set up proxying for client requests.
The following usage examples assumes
-
you are working in root directory of this project,
-
you have installed mitmproxy,
-
and that you have launched
mitmdumpon port8888in a separate terminal, withmitmdum -p 8888
NOTE: We use mitmproxy because it allows us to test the https connection to the proxy locally. However, it also requires using its own cacert for these use cases. This example executable can also be exercised with tinyproxy, excluding https connections to the proxy.
dune exec cohttp-eio/examples/client_proxy.exe -- \
--all-proxy=http://127.0.0.1:8888 \
http://httpbin.io/hostnamedune exec cohttp-eio/examples/client_proxy.exe -- \
--cacert=$HOME/.mitmproxy/mitmproxy-ca-cert.pem \
--all-proxy=http://127.0.0.1:8888 \
https://httpbin.io/hostnameThis exercises our support for TLS over TLS.
dune exec cohttp-eio/examples/client_proxy.exe -- \
--cacert=$HOME/.mitmproxy/mitmproxy-ca-cert.pem \
--all-proxy=https://127.0.0.1:8888 \
https://httpbin.io/hostname