owainlewis / digital-ocean

Idiomatic Clojure client for Digital Ocean that makes it easy to boot virtual servers from your REPL
37 stars 13 forks source link

fix for "Library does not support http proxy #13" #14

Open behrica opened 10 years ago

behrica commented 10 years ago

Using http-clj-lite instead og http-kit. This allows to use http proxies via setting of system properties (http.xxxx)

I tried it by setting proxy host and port. I did not test proxy authentication

owainlewis commented 10 years ago

I'd be happy to look into this but it would be quite a big refactor so would need some time to take a look properly.

behrica commented 9 years ago

I just rebased this with your latest changes.

To work on my project I need both:

As I use this code on a daily base, I am rather convinced that my change to clj-http-light did not break anything

owainlewis commented 9 years ago

Hi. We can add proxy support. Would you be happy to consider https://github.com/dakrone/clj-http as that's a client I've worked with more often and it supports HTTP proxy.

(client/get "http://foo.com" {:proxy-host "127.0.0.1" :proxy-port 8118})
behrica commented 9 years ago

I Just saw you previous comment while typing this ....

Do you have an idea when you have the time to look at it ?

I am asking, because my application at the end needs to run on heroku, so I need a version of this library on clojars containing both fixes.

If it still takes some time, I would do a clojars release of my branch as:

org.clojars.behrica/digitalocean:1.3

behrica commented 9 years ago

In principle this https://github.com/dakrone/clj-http is fine. I just took clj-http-lite, which is a fork from previous.

It has less features, but far less dependencies.

behrica commented 9 years ago

Maybe not a fork any more...

It has the same API, see here for differences:

https://github.com/hiredman/clj-http-lite

It has for sure far less dependencies AND it supports taking the http- settings from system settings, which clj-http does NOT do by default. (as it is based on Apache HttpComponents client, which does not support teh system settings (by default )).

But at the end I don´t mind. As long there is a way of specify the proxy. (proxy host + proxy port)

owainlewis commented 9 years ago

I should be able to look at this today in theory as it's a pretty small change. You are welcome to push a different version to Clojars if it helps.

behrica commented 9 years ago

Just wanted to mention one more thing.

In reality I need to authenticate against the proxy (username + password).

The problem is, that I did not get it working neither with clj-http nor clj-http-lite ..

There are some discussions on both projects about it, but the released versions of both do not work for me....

I solved it finally by installing locally a proxy which authenticates and forwards to our company proxy. This is for me "in general" better anyway, as like this I have my username/password in a single place only.

But you might want to think, if you want to add a more complete proxy support including authentication.

I don´t need this, as I said. I could eventually help you in testing it, if you develop it.

owainlewis commented 9 years ago

I feel your pain of working with proxies. I have to deal with them as well day to day. Will do my best to fix this for you. : )

behrica commented 9 years ago

Java and proxies is a pain ... If you are interested, I installed locally cntlm-0.92.3 (does not need admin rights on windows to run ...)

So i just need to configure "everywhere" to use "localhost:3128" as proxy.

This helps A LOT as configure proxy authentication is not supported by all tools/libraries and changing my passoword means change in a single place only.