From efcc6585a68e830fc0b6885dbebe89830beeb9e5 Mon Sep 17 00:00:00 2001 From: Nigel Brookes-Thomas Date: Thu, 26 Mar 2020 11:36:27 +0000 Subject: [PATCH] we don't support chunked transfer encoding, strip that from the response headeers --- lib/roda/proxy.rb | 6 +++++- lib/roda/proxy/version.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/roda/proxy.rb b/lib/roda/proxy.rb index 6f6e33a..16b4792 100644 --- a/lib/roda/proxy.rb +++ b/lib/roda/proxy.rb @@ -37,6 +37,7 @@ class Roda def proxy method = Faraday.method(env['REQUEST_METHOD'].downcase.to_sym) f_response = method.call(_proxy_url) { |req| _proxy_request(req) } +# p f_response _respond(f_response) end @@ -92,7 +93,10 @@ class Roda def _respond(proxied_response) response.status = proxied_response.status - proxied_response.headers.each { |k, v| response[k] = v } + proxied_response + .headers + .reject { |k, v| k.downcase == 'transfer-encoding' } + .each { |k, v| response[k] = v } response['Via'] = _via_header_string response.write(proxied_response.body) end diff --git a/lib/roda/proxy/version.rb b/lib/roda/proxy/version.rb index cbb4f95..6514687 100644 --- a/lib/roda/proxy/version.rb +++ b/lib/roda/proxy/version.rb @@ -2,6 +2,6 @@ class Roda module Proxy - VERSION = '1.0.4' + VERSION = '1.0.5' end end