Class: Net::HTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/socksify/http.rb

Overview

patched class

Defined Under Namespace

Modules: SOCKSProxyDelta

Class Method Summary collapse

Class Method Details

.proxyclassObject



41
42
43
# File 'lib/socksify/http.rb', line 41

def self.proxyclass
  @proxyclass ||= Class.new(self).tap { |klass| klass.send(:include, SOCKSProxyDelta) }
end

.socks_proxy(p_host, p_port, username: nil, password: nil) ⇒ Object Also known as: SOCKSProxy



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/socksify/http.rb', line 26

def self.socks_proxy(p_host, p_port, username: nil, password: nil)
  proxyclass.module_eval do
    include Ruby3NetHTTPConnectable if RUBY_VERSION.to_f > 3.0 # patch #connect method
    include SOCKSProxyDelta::InstanceMethods
    extend SOCKSProxyDelta::ClassMethods

    @socks_server = p_host
    @socks_port = p_port
    @socks_username = username
    @socks_password = password
  end

  proxyclass
end