Class: Net::HTTP

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

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#request_tor(req, torctrl_cir, body = nil, &block) ⇒ Object

Sends an HTTPRequest object REQUEST to the HTTP proxy such as polipo, and attach all new streams to the circuit specified in torctrl_cir. torctrl_cir = :cirnum,:hop Tor config must already be set to allow leaky circuits and attaching streams to the nodes other than the 3rd node. Similar to HTTP.request When called with a block, yields an HTTPResponse object. The body of this response will not have been read yet; the caller can process it using HTTPResponse#read_body, if desired.

Returns a HTTPResponse object.

This method never raises Net::* exceptions. The method has been implemented, but a circuit have been built to successfullty attach a stream to it.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/httpmod.rb', line 20

def request_tor(req,torctrl_cir, body = nil, &block) 
  unless started?
    start {
      req['connection'] ||= 'close'
      return request(req, body, &block)
    }
  end
  if proxy_user()
    req.proxy_basic_auth proxy_user(), proxy_pass() unless use_ssl?
  end
  req.set_body_internal body
  res = transport_request_tor(req, torctrl_cir, &block)
  if sspi_auth?(res)
    sspi_auth(req)
    res = transport_request_tor(req, torctrl_cir, &block)
  end
  res
end

#request_torget(path, torctrl_cir, initheader = nil, &block) ⇒ Object

Sends an HTTPRequest object GET REQUEST to the HTTP proxy such as polipo, and attach all new streams to the circuit specified in torctrl_cir. torctrl_cir = :cirnum,:hop Tor config must already be set to allow leaky circuits and attaching streams to the nodes other than the 3rd node. Similar to HTTP.request_get The method has been implemented, but a circuit have been built to successfullty attach a stream to it.



45
46
47
# File 'lib/httpmod.rb', line 45

def request_torget(path, torctrl_cir, initheader = nil, &block)
  request_tor(Get.new(path, initheader),torctrl_cir, &block)
end