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

Proxy through connection pool raised an error #740

Open
ozjongwon opened this issue Dec 8, 2024 · 3 comments
Open

Proxy through connection pool raised an error #740

ozjongwon opened this issue Dec 8, 2024 · 3 comments

Comments

@ozjongwon
Copy link

ozjongwon commented Dec 8, 2024

(def +conn-pool+
  (http/connection-pool {:connection-options {;;:http-versions [:http2 :http1]
                                              :proxy-options {:host "127.0.0.1"
                                                              :port 9050
                                                              :protocol :socks5
                                                              :connection-timeout (* 5 1000)}}
                         ;;:total-connections 1024
                         }))

@(http/get "https://check.torproject.org" {:pool +conn-pool+})

=>
1. Unhandled io.netty.handler.proxy.ProxyConnectException
   socks5, none, /127.0.0.1:9050 => null, unexpected authMethod: UNACCEPTED(255)

   Socks5ProxyHandler.java:  140  io.netty.handler.proxy.Socks5ProxyHandler/handleResponse
         ProxyHandler.java:  260  io.netty.handler.proxy.ProxyHandler/channelRead
AbstractChannelHandlerContext.java:  442  io.netty.channel.AbstractChannelHandlerContext/invokeChannelRead
AbstractChannelHandlerContext.java:  420  io.netty.channel.AbstractChannelHandlerContext/invokeChannelRead
AbstractChannelHandlerContext.java:  412  io.netty.channel.AbstractChannelHandlerContext/fireChannelRead
 ByteToMessageDecoder.java:  346  io.netty.handler.codec.ByteToMessageDecoder/fireChannelRead
 ByteToMessageDecoder.java:  333  io.netty.handler.codec.ByteToMessageDecoder/fireChannelRead
     ReplayingDecoder.java:  349  io.netty.handler.codec.ReplayingDecoder/callDecode
 ByteToMessageDecoder.java:  290  io.netty.handler.codec.ByteToMessageDecoder/channelRead
AbstractChannelHandlerContext.java:  444  io.netty.channel.AbstractChannelHandlerContext/invokeChannelRead
AbstractChannelHandlerContext.java:  420  io.netty.channel.AbstractChannelHandlerContext/invokeChannelRead

(Equivalent?) curl command works.

curl --verbose --proxy socks5://127.0.0.1:9050 https://check.torproject.org
Can anyone point why it happens and how to fix?

Thanks!

@arnaudgeiser
Copy link
Collaborator

While the root-cause remains unclear, this is where the error is pointing at on the Netty's code base [1].
This could be give you a pointer to start with.

[1] : https://github.com/netty/netty/blob/dc999c4b87d5023bfcf9ec73a8d7481e7bf5bdbf/handler-proxy/src/main/java/io/netty/handler/proxy/Socks5ProxyHandler.java#L138-L141

@arnaudgeiser
Copy link
Collaborator

And the response means the same authentification methods are not used between Netty and curl.
What are you receiving back as an HTTP response from the CURL command?

[1] : https://github.com/netty/netty/blob/4.1/codec-socks/src/main/java/io/netty/handler/codec/socksx/v5/Socks5AuthMethod.java#L30-L33

@ozjongwon
Copy link
Author

There is no auth config in the proxy. So curl spat out the correct HTML response. I am not sure if the 'proxy' path of the connection pool is in working state or not. Also it seems not to support noop for DNS lookup for Socks5h requests(when I looked it, I didn't find one)

Thanks

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

No branches or pull requests

2 participants