fix error

This commit is contained in:
邱博亞 2023-04-02 23:21:58 +08:00
parent b5a297e875
commit 42c8b4f45f
1 changed files with 3 additions and 9 deletions

View File

@ -86,24 +86,18 @@ class Roda
.join('-') .join('-')
end end
.merge({ .merge({
'Host' => "localhost", 'Host' => "127.0.0.1"
'Via' => _via_header_string
}) })
end end
def _respond(proxied_response) def _respond(proxied_response)
response.status = proxied_response.status response.status = proxied_response.code.to_i
proxied_response proxied_response
.headers .each_header.to_h
.reject { |k, v| k.downcase == 'transfer-encoding' } .reject { |k, v| k.downcase == 'transfer-encoding' }
.each { |k, v| response[k] = v } .each { |k, v| response[k] = v }
response['Via'] = _via_header_string
response.write(proxied_response.body) response.write(proxied_response.body)
end end
def _via_header_string
"#{env['SERVER_PROTOCOL']} #{env['SERVER_NAME']}:#{env['SERVER_PORT']}"
end
end end
end end