diff --git a/gateway/conf.d/apicast.conf b/gateway/conf.d/apicast.conf index 9b1038e73..af45a8d7d 100644 --- a/gateway/conf.d/apicast.conf +++ b/gateway/conf.d/apicast.conf @@ -84,23 +84,6 @@ location @upstream { header_filter_by_lua_block { require('apicast.executor'):header_filter() } } -location @upstream_unbuffered { - internal; - - rewrite_by_lua_block { - require('resty.ctx').apply() - } - - proxy_request_buffering off; - proxy_buffering off; - {% include "conf.d/upstream_shared.conf" %} - - # these are duplicated so when request is redirected here those phases are executed - post_action @out_of_band_authrep_action; - body_filter_by_lua_block { require('apicast.executor'):body_filter() } - header_filter_by_lua_block { require('apicast.executor'):header_filter() } -} - location @upstream_request_unbuffered { internal; @@ -117,22 +100,6 @@ location @upstream_request_unbuffered { header_filter_by_lua_block { require('apicast.executor'):header_filter() } } -location @upstream_response_buffering { - internal; - - rewrite_by_lua_block { - require('resty.ctx').apply() - } - - proxy_buffering off; - {% include "conf.d/upstream_shared.conf" %} - - # these are duplicated so when request is redirected here those phases are executed - post_action @out_of_band_authrep_action; - body_filter_by_lua_block { require('apicast.executor'):body_filter() } - header_filter_by_lua_block { require('apicast.executor'):header_filter() } -} - location / { set $cached_key ''; set $credentials ''; diff --git a/gateway/src/apicast/policy/buffering/apicast-policy.json b/gateway/src/apicast/policy/buffering/apicast-policy.json index 67a422cd9..c35d31b38 100644 --- a/gateway/src/apicast/policy/buffering/apicast-policy.json +++ b/gateway/src/apicast/policy/buffering/apicast-policy.json @@ -1,9 +1,9 @@ { "$schema": "http://apicast.io/policy-v1/schema#manifest#", - "name": "3scale Request/Response buffering", - "summary": "Controls how 3scale buffer request/response", + "name": "3scale Request buffering", + "summary": "Controls how 3scale buffer request", "description": [ - "Configures the buffering for request and response" + "Configures the buffering for request" ], "version": "builtin", "configuration": { @@ -13,11 +13,6 @@ "description": "Request Buffering mode", "type": "boolean", "default": true - }, - "response_buffering": { - "description": "Response Buffering mode", - "type": "boolean", - "default": true } } } diff --git a/gateway/src/apicast/policy/buffering/buffering.lua b/gateway/src/apicast/policy/buffering/buffering.lua index 9b4be53c6..d8d9a466d 100644 --- a/gateway/src/apicast/policy/buffering/buffering.lua +++ b/gateway/src/apicast/policy/buffering/buffering.lua @@ -12,14 +12,12 @@ local new = _M.new function _M.new(config) local self = new(config) self.request_buffering = config.request_buffering - self.response_buffering = config.response_buffering return self end function _M:export() return { request_buffering = self.request_buffering, - response_buffering = self.response_buffering } end diff --git a/gateway/src/apicast/upstream.lua b/gateway/src/apicast/upstream.lua index ce2413fb0..4de3c28da 100644 --- a/gateway/src/apicast/upstream.lua +++ b/gateway/src/apicast/upstream.lua @@ -215,14 +215,8 @@ local function get_upstream_location_name(context) return context.upstream_location_name end if context.request_buffering == false then - if context.response_buffering == false then - return "@upstream_unbuffered" - end return "@upstream_request_unbuffered" end - if context.response_buffering == false then - return "@upstream_response_unbuffered" - end end --- Execute the upstream. diff --git a/spec/policy/buffering/buffering_spec.lua b/spec/policy/buffering/buffering_spec.lua index 8fb044e3b..39487b0b2 100644 --- a/spec/policy/buffering/buffering_spec.lua +++ b/spec/policy/buffering/buffering_spec.lua @@ -7,19 +7,16 @@ describe('Buffering policy', function() local exported = policy:export() assert.same(true, exported.request_buffering) - assert.same(true, exported.response_buffering) end) it('accepts configuration', function() local config_buffering = { request_buffering = false, - response_buffering = false, } local policy = BufferingPolicy.new(config_buffering) local exported = policy:export() assert.same(false, exported.request_buffering) - assert.same(false, exported.response_buffering) end) end) end) diff --git a/spec/upstream_spec.lua b/spec/upstream_spec.lua index efa1d42ca..d4d2d496b 100644 --- a/spec/upstream_spec.lua +++ b/spec/upstream_spec.lua @@ -220,15 +220,9 @@ describe('Upstream', function() it('executes the upstream location when request_buffering provided in the context', function() local contexts = { ["buffered_request"] = {ctx={request_buffering=true}, upstream_location="@upstream"}, - ["buffered_response"] = {ctx={response_buffering=true}, upstream_location="@upstream"}, ["unbuffered_request"] = {ctx={request_buffering=false}, upstream_location="@upstream_request_unbuffered"}, - ["unbuffered_response"] = {ctx={response_buffering=false}, upstream_location="@upstream_response_unbuffered"}, - ["unbuffered"] = {ctx={request_buffering=false, response_buffering=false}, upstream_location="@upstream"}, ["upstream_location and buffered_request"] = {ctx={upstream_location_name="@grpc", request_buffering=true}, upstream_location="@grpc"}, - ["upstream_location and buffered_response"] = {ctx={upstream_location_name="@grpc", response_buffering=true}, upstream_location="@grpc"}, ["upstream_location and unbuffered_request"] = {ctx={upstream_location_name="@grpc", request_buffering=false}, upstream_location="@grpc"}, - ["upstream_location and unbuffered_response"] = {ctx={upstream_location_name="@grpc", response_buffering=false}, upstream_location="@grpc"}, - ["upstream_location and unbuffered"] = {ctx={upstream_location_name="@grpc", request_buffering=false, response_buffering=false}, upstream_location="@grpc"} } for _, value in pairs(contexts) do @@ -239,14 +233,6 @@ describe('Upstream', function() end end) - it('executes the upstream location when response_buffering provided in the context', function() - local upstream = Upstream.new('http://localhost') - - upstream:call({response_buffering=true}) - - assert.spy(ngx.exec).was_called_with("@upstream") - end) - it('skips executing the upstream location when missing', function() local upstream = Upstream.new('http://localhost') upstream.location_name = nil