Module: MechanizeSOCKSSupport

Included in:
Mechanize::HTTP::Agent, TheMask
Defined in:
lib/the_mask/mechanize_socks_support.rb

Instance Method Summary collapse

Instance Method Details

#fetch(uri, method = :get, headers = {}, params = [], referer = current_page, redirects = 0) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/the_mask/mechanize_socks_support.rb', line 10

def fetch(uri, method = :get, headers = {}, params = [], referer = current_page, redirects = 0)
  if @socks && !@socks_http.nil?
    html = @socks_http.get URI(uri)
    page = Struct.new(:uri, :body)
    page.new(uri, html)
  else
    super
  end
end

#set_proxy(addr, port, user = nil, pass = nil) ⇒ Object



5
6
7
8
# File 'lib/the_mask/mechanize_socks_support.rb', line 5

def set_proxy(addr, port, user = nil, pass = nil)
  @socks = false
  super
end