jcabi-http icon indicating copy to clipboard operation
jcabi-http copied to clipboard

Jcabi-http proxy tunneling support

Open super132 opened this issue 8 years ago • 8 comments

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.

super132 avatar May 27 '16 08:05 super132

@yegor256 please pay attention to this issue (par.21)

dmarkov avatar May 30 '16 09:05 dmarkov

@dmarkov pls assign @westonized

yegor256 avatar Jun 27 '16 21:06 yegor256

@dmarkov pls assign @westonized

@yegor256 yep, done. @westonized it is your task now

dmarkov avatar Jun 28 '16 10:06 dmarkov

@super132 thanks for reporting! I topped your account for 15 mins, transaction AP-6RL05986X3753332C

dmarkov avatar Jun 28 '16 10:06 dmarkov

@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();

westonal avatar Jul 01 '16 22:07 westonal

@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();

yegor256 avatar Jul 07 '16 22:07 yegor256

@westonized any updates on the solution?

krzyk avatar Aug 09 '16 14:08 krzyk

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:

image

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.

amihaiemil avatar May 25 '17 07:05 amihaiemil