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 proxy in HttpBrowser #56

Closed
pawelantczak opened this issue Dec 21, 2013 · 6 comments
Closed

Http proxy in HttpBrowser #56

pawelantczak opened this issue Dec 21, 2013 · 6 comments
Assignees

Comments

@pawelantczak
Copy link
Contributor

Can we set http proxy to be used in HttpRequest/Browser?

@ghost ghost assigned igr Dec 22, 2013
@igr
Copy link
Member

igr commented Dec 23, 2013

Hey Paweł, thank you for stopping by again :)

Not in a easy way at the moment, i think. But see #55, I will add support so this kind of things (custom sockets) can be easily added; moreover, I will add support for proxies - just need to do a little refactoring first.

TL;DR

The idea is that you will be able to set a HttpSocketProvider (new class, ex. HttpTransfer) in HttpBrowser with proxy definition, and use that one during the whole session. Something like:

HttpBrowser browser = new HttpBrowser();
browser.setProxy(host, port...);
// the rest is the same

Internal

Internally you would configure the HttpSocketProvider instance stored in HttpBrowser that will be passed to open() method of HttpRequest; so not to use default one.

@igr
Copy link
Member

igr commented Dec 23, 2013

Ok, I have added basic support for SOCKS proxies (with two latest commits), but without authentication. I will try to add different SocketFactories for different proxies (socks4, socks5 and http), but need a bit more time ;)

@igr igr closed this as completed in 1c62bd6 Dec 23, 2013
@igr
Copy link
Member

igr commented Dec 23, 2013

One way how to use it:

    HttpBrowser httpBrowser = new HttpBrowser();
    httpBrowser.setProxyInfo(ProxyInfo.httpProxy("192.168.0.106", 808, "user", "password"));

    httpBrowser.sendRequest(HttpRequest.get("google.com"));
    HttpResponse response = httpBrowser.getHttpResponse();
    System.out.println(response);

There is http, socks4 and socks5 implementation. Not for SSL (yet).

Enjoy!

@yizhl
Copy link

yizhl commented Jan 11, 2014

Now,download the latest version(3.4.10 all (10)) from Maven we can't see this imporvement When can we use it form Maven ?

@igr
Copy link
Member

igr commented Jan 11, 2014

Yes, its not released yet as Maven artifact. We will release SNAPSHOT during the next weekend.

Meanwhile, you can build it locally and play with it 😄 It is very easy to build it: http://jodd.org/source.html

@yizhl
Copy link

yizhl commented Jan 11, 2014

thanks O(∩_∩)O~ I think use maven would better to upgrade. I'm happy to hear that new released version is going in plan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants