Class: RProxy::CallbackConnection
- Inherits:
-
EM::Connection
- Object
- EM::Connection
- RProxy::CallbackConnection
- Defined in:
- lib/r_proxy/callback_connection.rb
Instance Method Summary collapse
- #assign_logger(logger) ⇒ Object
- #connection_completed ⇒ Object
-
#initialize(uri, user, pass, value, tls) ⇒ CallbackConnection
constructor
A new instance of CallbackConnection.
- #post_init ⇒ Object
- #receive_data(data) ⇒ Object
- #ssl_handshake_completed ⇒ Object
- #unbind ⇒ Object
Constructor Details
#initialize(uri, user, pass, value, tls) ⇒ CallbackConnection
Returns a new instance of CallbackConnection.
3 4 5 6 7 8 9 10 |
# File 'lib/r_proxy/callback_connection.rb', line 3 def initialize(uri, user, pass, value, tls) @uri = uri @path = uri.path.empty? ? '/' : uri.path @http_request = RProxy::HttpPostTemplate. new(@uri, @path).create(user, pass, value) @response = '' @need_tls = tls end |
Instance Method Details
#assign_logger(logger) ⇒ Object
12 13 14 |
# File 'lib/r_proxy/callback_connection.rb', line 12 def assign_logger(logger) @logger = logger end |
#connection_completed ⇒ Object
25 26 27 |
# File 'lib/r_proxy/callback_connection.rb', line 25 def connection_completed send_data(@http_request) if !@need_tls end |
#post_init ⇒ Object
16 17 18 19 |
# File 'lib/r_proxy/callback_connection.rb', line 16 def post_init start_tls if @need_tls set_comm_inactivity_timeout(20) end |
#receive_data(data) ⇒ Object
29 30 31 32 |
# File 'lib/r_proxy/callback_connection.rb', line 29 def receive_data(data) @response = data.split("\r\n")[0] close_connection end |
#ssl_handshake_completed ⇒ Object
21 22 23 |
# File 'lib/r_proxy/callback_connection.rb', line 21 def ssl_handshake_completed send_data(@http_request) end |
#unbind ⇒ Object
34 35 36 |
# File 'lib/r_proxy/callback_connection.rb', line 34 def unbind @logger.info("#{@uri.host}#{@path} response status: #{@response}") if @logger end |