lib/httpx/plugins/proxy/socks5.rb in httpx-0.19.8 vs lib/httpx/plugins/proxy/socks5.rb in httpx-0.20.0
- old
+ new
@@ -16,10 +16,14 @@
IPV6 = 4
SUCCESS = 0
Error = Socks5Error
+ def self.load_dependencies(*)
+ require_relative "../authentication/socks5"
+ end
+
module ConnectionMethods
def call
super
return unless @options.proxy && @options.proxy.uri.scheme == "socks5"
@@ -154,19 +158,17 @@
module Packet
module_function
def negotiate(parameters)
methods = [NOAUTH]
- methods << PASSWD if parameters.authenticated?
+ methods << PASSWD if parameters.can_authenticate?
methods.unshift(methods.size)
methods.unshift(VERSION)
methods.pack("C*")
end
def authenticate(parameters)
- user = parameters.username
- password = parameters.password
- [0x01, user.bytesize, user, password.bytesize, password].pack("CCA*CA*")
+ parameters.authenticate
end
def connect(uri)
packet = [VERSION, CONNECT, 0].pack("C*")
begin