Class: Hula::HttpProxyUpstreamSocks
- Inherits:
-
Object
- Object
- Hula::HttpProxyUpstreamSocks
- Includes:
- Hula::Helpers::SocketTools
- Defined in:
- lib/hula/http_proxy_upstream_socks.rb
Instance Attribute Summary collapse
-
#http_host ⇒ Object
readonly
Returns the value of attribute http_host.
-
#http_port ⇒ Object
readonly
Returns the value of attribute http_port.
Instance Method Summary collapse
-
#initialize(polipo_bin: 'polipo', socks_proxy:, http_host: 'localhost', http_port: free_port) ⇒ HttpProxyUpstreamSocks
constructor
A new instance of HttpProxyUpstreamSocks.
- #start ⇒ Object
- #stop ⇒ Object
Methods included from Hula::Helpers::SocketTools
free_port, port_open?, wait_for_port
Constructor Details
#initialize(polipo_bin: 'polipo', socks_proxy:, http_host: 'localhost', http_port: free_port) ⇒ HttpProxyUpstreamSocks
Returns a new instance of HttpProxyUpstreamSocks.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/hula/http_proxy_upstream_socks.rb', line 17 def initialize( polipo_bin: 'polipo', socks_proxy:, http_host: 'localhost', http_port: free_port ) @socks_proxy_host = socks_proxy.socks_host @socks_proxy_port = socks_proxy.socks_port @http_host = http_host @http_port = http_port @polipo_bin = polipo_bin check_polipo_bin! end |
Instance Attribute Details
#http_host ⇒ Object (readonly)
Returns the value of attribute http_host.
32 33 34 |
# File 'lib/hula/http_proxy_upstream_socks.rb', line 32 def http_host @http_host end |
#http_port ⇒ Object (readonly)
Returns the value of attribute http_port.
32 33 34 |
# File 'lib/hula/http_proxy_upstream_socks.rb', line 32 def http_port @http_port end |
Instance Method Details
#start ⇒ Object
34 35 36 |
# File 'lib/hula/http_proxy_upstream_socks.rb', line 34 def start @process ||= start_polipo_process end |
#stop ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/hula/http_proxy_upstream_socks.rb', line 38 def stop return unless @process Process.kill('TERM', @process) rescue Errno::ESRCH Process.wait(@process) rescue Errno::ECHILD @process = nil end |