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/2 client with SOCKS proxy hangs #2091

Closed
roby-rodriguez opened this issue Jan 3, 2018 · 6 comments
Closed

HTTP/2 client with SOCKS proxy hangs #2091

roby-rodriguez opened this issue Jan 3, 2018 · 6 comments
Assignees
Labels
Stale For auto-closed stale issues and pull requests

Comments

@roby-rodriguez
Copy link

I've been playing with the HTTP client lately and I would like to do some web scrapping through tor. The API worked well so far but after adding the proxy configuration the connection hangs - no errors, nothing

SslContextFactory sslContextFactory = new SslContextFactory(true);
HTTP2Client lowLevelClient = new HTTP2Client();
lowLevelClient.start();
HttpClient client = new HttpClient(new HttpClientTransportOverHTTP2(lowLevelClient), sslContextFactory);
ProxyConfiguration proxyConfig = client.getProxyConfiguration();
Socks4Proxy proxy = new Socks4Proxy("127.0.0.1", 9050);
// add the following line and program will hang..
// proxyConfig.getProxies().add(proxy);
client.start();
ContentResponse response = client.newRequest("https://google.com")
	.version(HttpVersion.HTTP_2)
	.send();

If I use HttpClient with a default constructor and set no version for the request, the above will work, however it will be HTTP/1.1 -> so the question would be is there something missing in this code or is it because of a missing feature?


I've also had a look at #426 which mentions (still) open issue #250 but can't figure out if the problems are related. Any ideas?

@dpnkr
Copy link

dpnkr commented Jan 15, 2018

Well I'm also facing the similar kind of issue so posting it here instead of creating another issue.
Here is how i'm doing it

SslContextFactory sslContextFactory = new SslContextFactory();
HttpClient httpClient = new HttpClient(sslContextFactory);
httpClient.start();
Address address = new Address("127.0.0.1",8082);
Socks4Proxy socks4Proxy = new Socks4Proxy(address, true);
proxyConfiguration.getProxies().add(socks4Proxy);
Request request = httpClient.newRequest(
				new URI("https://google.com"));
request.method(HttpMethod.GET);

ContentResponse contentResponse = request.send();
System.out.println(contentResponse.getContentAsString());

For the above I'm getting the following error :

Exception in thread "main" java.util.concurrent.ExecutionException: java.io.IOException: SOCKS4 tunnel failed with code 84
	at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:118)
	at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:101)
	at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:653)
	at Get.main(Get.java:43)
Caused by: java.io.IOException: SOCKS4 tunnel failed with code 84
	at org.eclipse.jetty.client.Socks4Proxy$Socks4ProxyConnection.onSocks4Response(Socks4Proxy.java:189)
	at org.eclipse.jetty.client.Socks4Proxy$Socks4ProxyConnection.access$300(Socks4Proxy.java:77)
	at org.eclipse.jetty.client.Socks4Proxy$Socks4ProxyConnection$Socks4Parser.parse(Socks4Proxy.java:228)
	at org.eclipse.jetty.client.Socks4Proxy$Socks4ProxyConnection$Socks4Parser.access$200(Socks4Proxy.java:212)
	at org.eclipse.jetty.client.Socks4Proxy$Socks4ProxyConnection.onFillable(Socks4Proxy.java:174)
	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
	at java.lang.Thread.run(Thread.java:745)

Can anyone suggest me how to resolve the issue ???

@roby-rodriguez can you see any error in my code ? because even if I try it by default httpclient constructor , it is giving me the same error ..

Fyi : for the proxy server i'm using burp

@sbordet
Copy link
Contributor

sbordet commented Jan 15, 2018

Can we please get the DEBUG logs ?

@stale
Copy link

stale bot commented Nov 20, 2019

This issue has been automatically marked as stale because it has been a full year without activit. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale For auto-closed stale issues and pull requests label Nov 20, 2019
@sbordet sbordet removed the Stale For auto-closed stale issues and pull requests label Nov 21, 2019
@sbordet sbordet self-assigned this Nov 21, 2019
@stale
Copy link

stale bot commented Nov 21, 2020

This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale For auto-closed stale issues and pull requests label Nov 21, 2020
@sbordet sbordet removed the Stale For auto-closed stale issues and pull requests label Nov 21, 2020
@github-actions
Copy link

This issue has been automatically marked as stale because it has been a
full year without activity. It will be closed if no further activity occurs.
Thank you for your contributions.

@github-actions github-actions bot added the Stale For auto-closed stale issues and pull requests label May 11, 2022
@sbordet sbordet removed the Stale For auto-closed stale issues and pull requests label May 12, 2022
@github-actions
Copy link

This issue has been automatically marked as stale because it has been a
full year without activity. It will be closed if no further activity occurs.
Thank you for your contributions.

@github-actions github-actions bot added the Stale For auto-closed stale issues and pull requests label May 13, 2023
@sbordet sbordet closed this as completed May 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale For auto-closed stale issues and pull requests
Projects
None yet
Development

No branches or pull requests

3 participants