Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP(S)/SOCKS5 Proxy support #515

Open
sgrove opened this issue Nov 22, 2016 · 4 comments
Open

HTTP(S)/SOCKS5 Proxy support #515

sgrove opened this issue Nov 22, 2016 · 4 comments
Labels

Comments

@sgrove
Copy link

sgrove commented Nov 22, 2016

I need to use SOCKS5 and HTTP proxies with Cohttp. I'm not sure if support belongs in the library proper, or another library with a bit of glue to work with Cohttp.

Is this possible currently?

@mor1
Copy link
Member

mor1 commented Nov 22, 2016

I'm tempted to suggest it belongs in a separate library that can be instantiated in a separate unikernel to the webserver in any deployment; but I don't know if that would fit with what the use you have in mind :)

(That may make more sense for SOCKS5 than HTTP proxy I guess. https://github.com/cfcs/ocaml-socks may also be relevant.)

@sgrove
Copy link
Author

sgrove commented Nov 22, 2016

My use case is simply that when I make an http request, I need it to go through a proxy (hosted on another machine, of course). For example, with the most popular Clojure http client's proxy support, it's simply a matter of passing in some extra named arguments (or the equivalent thereof):

;; No proxy, request will be directly between this machine and foo.com
(client/get "http://foo.com")

;; Request will go through HTTP proxy myproxyhost.com:8118
(client/get "http://foo.com" {:proxy-host "myproxyhost.com" :proxy-port 8118})

;; Request will go through SOCKS proxy 
(client/get "http://foo.com"
            {:connection-manager
             (conn-mgr/make-socks-proxied-conn-manager "mysocksproxyhost.com" 8081)})

Connections can also be stored and reused elsewhere, which can be useful for a number of different things.

What would the equivalent look like with Cohttp?

@tobiasBora
Copy link

I'm also interested if you have some informations about that.

@impvd
Copy link

impvd commented Sep 12, 2018

With Go's example:

proxyUrl, err := url.Parse("http://proxyIp:proxyPort")
myClient := &http.Client{Transport: &http.Transport{Proxy: http.ProxyURL(proxyUrl)}}

It's been nearly 2 years since @sgrove post this issue firstly, but there's still no answer for this common issue. I think this is one of the reason that keep people far away from OCaml.

eXenon pushed a commit to cryptosense/api-client that referenced this issue Dec 16, 2020
This change is motivated by the requirement to support HTTP proxies
for the communication with the API. At this point, cohttp does not
offer this support (see
mirage/ocaml-cohttp#515)
eXenon pushed a commit to cryptosense/api-client that referenced this issue Dec 17, 2020
This change is motivated by the requirement to support HTTP proxies
for the communication with the API. At this point, cohttp does not
offer this support (see
mirage/ocaml-cohttp#515)
@mseri mseri added the Feature label Apr 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants