Class: RubyHome::HAP::HAPRequest
- Inherits:
-
WEBrick::HTTPRequest
- Object
- WEBrick::HTTPRequest
- RubyHome::HAP::HAPRequest
- Defined in:
- lib/ruby_home/hap/hap_request.rb
Instance Method Summary collapse
-
#initialize(config, sock) ⇒ HAPRequest
constructor
A new instance of HAPRequest.
- #meta_vars ⇒ Object
- #parse(socket) ⇒ Object
- #received_encrypted_request? ⇒ Boolean
Constructor Details
#initialize(config, sock) ⇒ HAPRequest
Returns a new instance of HAPRequest.
4 5 6 7 8 9 |
# File 'lib/ruby_home/hap/hap_request.rb', line 4 def initialize(config, sock) @sock = sock cache[:controller_to_accessory_count] ||= 0 super(config) end |
Instance Method Details
#meta_vars ⇒ Object
28 29 30 |
# File 'lib/ruby_home/hap/hap_request.rb', line 28 def super.merge({"REQUEST_SOCKET" => sock}) end |
#parse(socket) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ruby_home/hap/hap_request.rb', line 11 def parse(socket) if decryption_time? request_line = socket.read_nonblock(@buffer_size) decrypted_request = decrypter.decrypt(request_line).join cache[:controller_to_accessory_count] = decrypter.count super(StringIO.new(decrypted_request)) else super(socket) end end |
#received_encrypted_request? ⇒ Boolean
24 25 26 |
# File 'lib/ruby_home/hap/hap_request.rb', line 24 def received_encrypted_request? cache[:controller_to_accessory_count] >= 1 end |