Fixes for Proxy creation from URL String and SOCKS5 authentication. Bump version number to 1.0.4.
This commit is contained in:
1 parent
41ead73b21
commit
bf1f0bee18
9 files changed
+107
-9
No files matched your search
@@ -3,7 +3,8 @@ require "proxifier/proxy"
|
||||
|
||||
module Proxifier
|
||||
class SOCKSProxy < Proxy
|
||||
VERSION = 0x05
|
||||
VERSION = 0x05
|
||||
SUBNEGOTIATION_VERSION = 0x01
|
||||
|
||||
def do_proxify(socket, host, port)
|
||||
authenticaton_method = greet(socket)
|
||||
@@ -26,12 +27,12 @@ module Proxifier
|
||||
case method
|
||||
when 0x00 # NO AUTHENTICATION REQUIRED
|
||||
when 0x02 # USERNAME/PASSWORD
|
||||
user &&= user[0, 0xFF]
|
||||
password &&= password[0, 0xFF]
|
||||
_user = user ? user[0, 0xFF] : ''
|
||||
_password = password ? password[0, 0xFF] : ''
|
||||
|
||||
socket << [user.size, user, password.size, password].pack("CA#{user.size}CA#{password.size}")
|
||||
version, status = socket.read(2).unpack("CC")
|
||||
check_version(version)
|
||||
socket << [SUBNEGOTIATION_VERSION, _user.size, _user, _password.size, _password].pack("CCA#{_user.size}CA#{_password.size}")
|
||||
version, status = socket.read(2).unpack('CC')
|
||||
check_version(version, SUBNEGOTIATION_VERSION)
|
||||
|
||||
case status
|
||||
when 0x00 # SUCCESS
|
||||
|
||||
@@ -16,7 +16,7 @@ module Proxifier
|
||||
attr_reader :url, :options
|
||||
|
||||
def initialize(url, options = {})
|
||||
url = URI.parse(uri) unless url.is_a?(URI::Generic)
|
||||
url = URI.parse(url) unless url.is_a?(URI::Generic)
|
||||
@url, @options = url, options
|
||||
end
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Proxifier
|
||||
VERSION = "1.0.3"
|
||||
VERSION = '1.0.4'
|
||||
end
|
||||
Reference in new issue
Block a user