Class: AgileProxy::ProxyConnection
- Inherits:
-
EventMachine::Connection
- Object
- EventMachine::Connection
- AgileProxy::ProxyConnection
- Defined in:
- lib/agile_proxy/proxy_connection.rb
Overview
The Proxy Connection
This class is the event machine connection used by the proxy. Every request creates a new instance of this
Instance Attribute Summary collapse
-
#handler ⇒ Object
Returns the value of attribute handler.
Instance Method Summary collapse
- #on_body(chunk) ⇒ Object
- #on_headers_complete(headers) ⇒ Object
- #on_message_begin ⇒ Object
- #on_message_complete ⇒ Object
- #post_init ⇒ Object
- #receive_data(data) ⇒ Object
Instance Attribute Details
#handler ⇒ Object
Returns the value of attribute handler.
16 17 18 |
# File 'lib/agile_proxy/proxy_connection.rb', line 16 def handler @handler end |
Instance Method Details
#on_body(chunk) ⇒ Object
34 35 36 |
# File 'lib/agile_proxy/proxy_connection.rb', line 34 def on_body(chunk) @body << chunk end |
#on_headers_complete(headers) ⇒ Object
30 31 32 |
# File 'lib/agile_proxy/proxy_connection.rb', line 30 def on_headers_complete(headers) @headers = headers end |
#on_message_begin ⇒ Object
25 26 27 28 |
# File 'lib/agile_proxy/proxy_connection.rb', line 25 def @headers = nil @body = '' end |
#on_message_complete ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/agile_proxy/proxy_connection.rb', line 38 def if @parser.http_method == 'CONNECT' restart_with_ssl(@parser.request_url) else if @ssl uri = URI.parse(@parser.request_url) @url = "https://#{@ssl}#{[uri.path, uri.query].compact.join('?')}" else @url = @parser.request_url end handle_request end end |
#post_init ⇒ Object
17 18 19 |
# File 'lib/agile_proxy/proxy_connection.rb', line 17 def post_init @parser = Http::Parser.new(self) end |
#receive_data(data) ⇒ Object
21 22 23 |
# File 'lib/agile_proxy/proxy_connection.rb', line 21 def receive_data(data) @parser << data end |