Class: HTTPTunnelClient

Inherits:
Object
  • Object
show all
Defined in:
lib/appswarm/tools/http_tunnel_client.rb

Defined Under Namespace

Classes: Server

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(localPort, remoteHost, remotePort) ⇒ HTTPTunnelClient

Returns a new instance of HTTPTunnelClient.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/appswarm/tools/http_tunnel_client.rb', line 54

def initialize(localPort,remoteHost,remotePort)
  uri=URI.parse("https://#{remoteHost}:#{remotePort}/")
  http = Net::HTTP.new(uri.host, uri.port)
  http.verify_mode=OpenSSL::SSL::VERIFY_NONE
  http.use_ssl = true if uri.scheme == "https"  # enable SSL/TLS
  
  @http=http
  @socket=nil
  @out=""
  @in=[]
  @mutex=Mutex.new
  
#    ops=
  @gserver=Server.new(localPort,self)
  @gserver.start
  
  Thread.new {
    begin
      loop do
    check
    
    sleep 0.5
    end
    rescue Object=>e
      pp e,e.backtrace
    end
  }
end

Instance Attribute Details

#socketObject

Returns the value of attribute socket.



11
12
13
# File 'lib/appswarm/tools/http_tunnel_client.rb', line 11

def socket
  @socket
end

Instance Method Details

#push(data) ⇒ Object



83
84
85
86
# File 'lib/appswarm/tools/http_tunnel_client.rb', line 83

def push(data)
  @out+=data
  check
end