jcabi-http
jcabi-http copied to clipboard
Jcabi-http proxy tunneling support
It would be great if jcabi-http supports HTTP proxy settings / tunneling. Right now in environments that traffic requires proxy access, jcabi-http fails to do so as it does not accept any proxy information to establish the connection. This limits the usage of this library.
@yegor256 please pay attention to this issue (par.21)
@dmarkov pls assign @westonized
@dmarkov pls assign @westonized
@yegor256 yep, done. @westonized it is your task now
@super132 thanks for reporting! I topped your account for 15 mins, transaction AP-6RL05986X3753332C
@yegor256 This is so wide open, as PO can you provide an example of the desired syntax?
i.e. adjust this to take proxy settings, and does it also require to take authentication?
String html = new JdkRequest("https://www.google.com/test")
.uri().path("/users").queryParam("id", 333).back()
.method(Request.GET)
.header(HttpHeaders.ACCEPT, MediaType.TEXT_HTML)
.fetch()
.as(RestResponse.class)
.assertStatus(HttpURLConnection.HTTP_OK)
.body();
@westonized I think it should be done like this:
String html = new JdkRequest("https://www.google.com/test")
.uri().path("/users").queryParam("id", 333).back()
.method(Request.GET)
.header(HttpHeaders.ACCEPT, MediaType.TEXT_HTML)
.through(ProxyWire.class, "192.168.1.1", "8080", "login", "password") // this one!
.fetch()
.as(RestResponse.class)
.assertStatus(HttpURLConnection.HTTP_OK)
.body();
@westonized any updates on the solution?
Until this ticket is resolved, if you're using JdkRequest
, you can set the proxy on the JVM and it will work. You can easily set it, for example in eclipse:
If you're using JavaEE you may have to set it on the server's (Jboss, Glassfish etc) JDK as well, unless it uses the jdk provided by the IDE.