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

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

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

Returns a new instance of Response.

Parameters:

  • reason (String)

    HTTP response line reason, ignored.



37
38
39
40
41
42
43
# File 'lib/async/http/protocol/http1/response.rb', line 37

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

Class Method Details

.read(connection, request) ⇒ Object



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

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

Instance Method Details

#connectionObject



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

def connection
	@connection
end

#hijack!Object



53
54
55
# File 'lib/async/http/protocol/http1/response.rb', line 53

def hijack!
	@connection.hijack!
end

#hijack?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/async/http/protocol/http1/response.rb', line 49

def hijack?
	@body.nil?
end