Class: Proxy::RemoteExecution::Cockpit::Session
- Inherits:
-
Object
- Object
- Proxy::RemoteExecution::Cockpit::Session
- Includes:
- Log
- Defined in:
- lib/smart_proxy_remote_execution_ssh/cockpit.rb
Instance Method Summary collapse
- #hijack! ⇒ Object
-
#initialize(env) ⇒ Session
constructor
A new instance of Session.
- #valid? ⇒ Boolean
Constructor Details
#initialize(env) ⇒ Session
Returns a new instance of Session.
114 115 116 |
# File 'lib/smart_proxy_remote_execution_ssh/cockpit.rb', line 114 def initialize(env) @env = env end |
Instance Method Details
#hijack! ⇒ Object
122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/smart_proxy_remote_execution_ssh/cockpit.rb', line 122 def hijack! @socket = nil if @env['ext.hijack!'] @socket = @env['ext.hijack!'].call elsif @env['rack.hijack?'] begin @env['rack.hijack'].call rescue NotImplementedError end @socket = @env['rack.hijack_io'] end raise 'Internal error: request hijacking not available' unless @socket ssh_on_socket end |
#valid? ⇒ Boolean
118 119 120 |
# File 'lib/smart_proxy_remote_execution_ssh/cockpit.rb', line 118 def valid? @env["HTTP_CONNECTION"] == "upgrade" && @env["HTTP_UPGRADE"].to_s.split(',').any? { |part| part.strip == "raw" } end |