class Request < ::Protocol::HTTP::Request
- Inherits from
::Protocol::HTTP::Request
A reconstructed request owned by the execution context.
Definitions
def initialize(description, endpoint)
Initialize a reconstructed request.
Signature
-
parameter
descriptionHash The serialized request description.
-
parameter
endpointTransport::Endpoint The worker transport endpoint.
Implementation
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 metadata = description[:body]
Body::Input.new(endpoint.body, headers, metadata)
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
attr :peer
Signature
-
attribute
Protocol::HTTP::Peer | Nil The reconstructed remote peer.