Class: Billy::ProxyConnection
- Inherits:
-
EventMachine::Connection
- Object
- EventMachine::Connection
- Billy::ProxyConnection
- Includes:
- EventMachine::Deferrable
- Defined in:
- lib/billy/proxy_connection.rb
Instance Attribute Summary collapse
-
#cache ⇒ Object
Returns the value of attribute cache.
-
#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
#cache ⇒ Object
Returns the value of attribute cache.
13 14 15 |
# File 'lib/billy/proxy_connection.rb', line 13 def cache @cache end |
#handler ⇒ Object
Returns the value of attribute handler.
12 13 14 |
# File 'lib/billy/proxy_connection.rb', line 12 def handler @handler end |
Instance Method Details
#on_body(chunk) ⇒ Object
32 33 34 |
# File 'lib/billy/proxy_connection.rb', line 32 def on_body(chunk) @body << chunk end |
#on_headers_complete(headers) ⇒ Object
28 29 30 |
# File 'lib/billy/proxy_connection.rb', line 28 def on_headers_complete(headers) @headers = headers end |
#on_message_begin ⇒ Object
23 24 25 26 |
# File 'lib/billy/proxy_connection.rb', line 23 def @headers = nil @body = '' end |
#on_message_complete ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/billy/proxy_connection.rb', line 36 def if @parser.http_method == 'CONNECT' restart_with_ssl(@parser.request_url) else if defined?(@ssl) && @ssl uri = Addressable::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
15 16 17 |
# File 'lib/billy/proxy_connection.rb', line 15 def post_init @parser = Http::Parser.new(self) end |
#receive_data(data) ⇒ Object
19 20 21 |
# File 'lib/billy/proxy_connection.rb', line 19 def receive_data(data) @parser << data end |