Class: Async::HTTP::Protocol::HTTP1::Response

Inherits:
Response
  • Object
show all
Defined in:
lib/async/http/protocol/http1/response.rb

Instance Attribute Summary

Attributes inherited from Response

#connection

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Response

#peer, #remote_address, #remote_address=

Constructor Details

#initialize(connection, version, status, reason, headers, body) ⇒ Response



34
35
36
37
38
39
40
# File 'lib/async/http/protocol/http1/response.rb', line 34

def initialize(connection, version, status, reason, headers, body)
  @connection = connection
  
  protocol = connection.upgrade?(headers)
  
  super(version, status, reason, headers, body, protocol)
end

Class Method Details

.read(connection, request) ⇒ Object



28
29
30
31
32
# File 'lib/async/http/protocol/http1/response.rb', line 28

def self.read(connection, request)
  if parts = connection.read_response(request.method)
    self.new(connection, *parts)
  end
end

Instance Method Details

#hijack!Object



46
47
48
# File 'lib/async/http/protocol/http1/response.rb', line 46

def hijack!
  @connection.hijack!
end

#hijack?Boolean



42
43
44
# File 'lib/async/http/protocol/http1/response.rb', line 42

def hijack?
  @body.nil?
end