Class: Protocol::HTTP::Executor::Request

Inherits:
Request
  • Object
show all
Defined in:
lib/protocol/http/executor/request.rb

Overview

A reconstructed request owned by the execution context.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(description, endpoint) ⇒ Request

Initialize a reconstructed request.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/protocol/http/executor/request.rb', line 18

def initialize(description, endpoint)
	@peer = if address = description[:peer]
		::Protocol::HTTP::Peer.new(address)
	end
	
	headers = ::Protocol::HTTP::Headers[description[:headers]]
	if trailers = description[:trailers]
		headers.trailer!
		trailers.each{|key, value| headers.add(key, value, trailer: true)}
	end
	
	body = if  = description[:body]
		Body::Input.new(endpoint.body, headers, )
	end
	
	interim_response = proc do |status, interim_headers|
		fields = ::Protocol::HTTP::Headers[interim_headers].header.to_a
		endpoint.control.write(:interim_response, [status, fields])
	end
	
	super(
		description[:scheme],
		description[:authority],
		description[:method],
		description[:path],
		description[:version],
		headers,
		body,
		description[:protocol],
		interim_response,
	)
end

Instance Attribute Details

#peerObject (readonly)

Returns the value of attribute peer.



52
53
54
# File 'lib/protocol/http/executor/request.rb', line 52

def peer
  @peer
end

#The reconstructed remote peer.(reconstructedremotepeer.) ⇒ Object (readonly)



52
# File 'lib/protocol/http/executor/request.rb', line 52

attr :peer