From 42c8b4f45f494621ab701a775e8ed5e88ff051dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Sun, 2 Apr 2023 23:21:58 +0800 Subject: [PATCH] fix error --- lib/roda/proxy.rb | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/roda/proxy.rb b/lib/roda/proxy.rb index f2b5dad..48103be 100644 --- a/lib/roda/proxy.rb +++ b/lib/roda/proxy.rb @@ -86,24 +86,18 @@ class Roda .join('-') end .merge({ - 'Host' => "localhost", - 'Via' => _via_header_string + 'Host' => "127.0.0.1" }) end def _respond(proxied_response) - response.status = proxied_response.status + response.status = proxied_response.code.to_i proxied_response - .headers + .each_header.to_h .reject { |k, v| k.downcase == 'transfer-encoding' } .each { |k, v| response[k] = v } - response['Via'] = _via_header_string response.write(proxied_response.body) end - - def _via_header_string - "#{env['SERVER_PROTOCOL']} #{env['SERVER_NAME']}:#{env['SERVER_PORT']}" - end end end