Skip to content

Commit

Permalink
Add authentication support to Net::HTTP.SOCKSProxy
Browse files Browse the repository at this point in the history
  • Loading branch information
ojab committed Sep 3, 2015
1 parent 7461307 commit f20881b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/socksify/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

module Net
class HTTP
def self.SOCKSProxy(p_host, p_port)
def self.SOCKSProxy(p_host, p_port, p_username = nil, p_password = nil)
delta = SOCKSProxyDelta
proxyclass = Class.new(self)
proxyclass.send(:include, delta)
Expand All @@ -31,6 +31,8 @@ def self.SOCKSProxy(p_host, p_port)
@socks_server = p_host
@socks_port = p_port
}
TCPSocket.class_variable_set(:@@socks_username, p_username) if p_username
TCPSocket.class_variable_set(:@@socks_password, p_password) if p_password
proxyclass
end

Expand Down

0 comments on commit f20881b

Please sign in to comment.