class Protocol::Rack::Adapter::Generic
def unwrap_request(request, env)
@parameter request [Protocol::HTTP::Request] The incoming request.
- Set `env['REMOTE_ADDR']` to the request remote adress.
- Set the `env['HTTP_X_FORWARDED_PROTO']` header to the request scheme.
- Set the `env['HTTP_HOST']` header to the request authority.
- Set the `env['CONTENT_TYPE']` and `env['CONTENT_LENGTH']` based on the incoming request body.
Process the incoming request into a valid rack `env`.
def unwrap_request(request, env) if content_type = request.headers.delete('content-type') env[CGI::CONTENT_TYPE] = content_type end # In some situations we don't know the content length, e.g. when using chunked encoding, or when decompressing the body. if body = request.body and length = body.length env[CGI::CONTENT_LENGTH] = length.to_s end self.unwrap_headers(request.headers, env) # HTTP/2 prefers `:authority` over `host`, so we do this for backwards compatibility. env[CGI::HTTP_HOST] ||= request.authority if request.respond_to?(:remote_address) if remote_address = request.remote_address env[CGI::REMOTE_ADDR] = remote_address.ip_address if remote_address.ip? end end end