Module: HTTPX::Plugins::Proxy::Socks4::ConnectionMethods

Defined in:
lib/httpx/plugins/proxy/socks4.rb,
sig/plugins/proxy/socks4.rbs

Instance Method Summary collapse

Instance Method Details

#__socks4_on_packet(packet) ⇒ void

This method returns an undefined value.

Parameters:

  • packet (String)


66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/httpx/plugins/proxy/socks4.rb', line 66

def __socks4_on_packet(packet)
  _version, status, _port, _ip = packet.unpack("CCnN")
  if status == GRANTED
    req = @pending.first
    request_uri = req.uri
    @io = ProxySSL.new(@io, request_uri, @options) if request_uri.scheme == "https"
    transition(:connected)
    throw(:called)
  else
    on_socks4_error("socks error: #{status}")
  end
end

#__socks4_proxy_connectvoid

This method returns an undefined value.



61
62
63
64
# File 'lib/httpx/plugins/proxy/socks4.rb', line 61

def __socks4_proxy_connect
  @parser = SocksParser.new(@write_buffer, @options)
  @parser.once(:packet, &method(:__socks4_on_packet))
end

#interestsObject



26
27
28
29
30
31
32
# File 'lib/httpx/plugins/proxy/socks4.rb', line 26

def interests
  if @state == :connecting
    return @write_buffer.empty? ? :r : :w
  end

  super
end

#on_socks4_error(message) ⇒ void

This method returns an undefined value.

Parameters:

  • (string)


79
80
81
82
83
84
# File 'lib/httpx/plugins/proxy/socks4.rb', line 79

def on_socks4_error(message)
  ex = Error.new(message)
  ex.set_backtrace(caller)
  on_error(ex)
  throw(:called)
end