From 9f97df2275638ef80ca104dd0ca51e5a7ab93b21 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 22 Apr 2024 15:34:14 -0600 Subject: [PATCH] reverseproxy: Remove long-deprecated buffering properties They've been deprecated for over a year and we printed warnings during that time. --- modules/caddyhttp/reverseproxy/caddyfile.go | 27 ------------------- .../caddyhttp/reverseproxy/reverseproxy.go | 20 -------------- 2 files changed, 47 deletions(-) diff --git a/modules/caddyhttp/reverseproxy/caddyfile.go b/modules/caddyhttp/reverseproxy/caddyfile.go index 8dfbd93d..31fdd077 100644 --- a/modules/caddyhttp/reverseproxy/caddyfile.go +++ b/modules/caddyhttp/reverseproxy/caddyfile.go @@ -607,33 +607,6 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { h.ResponseBuffers = size } - // TODO: These three properties are deprecated; remove them sometime after v2.6.4 - case "buffer_requests": // TODO: deprecated - if d.NextArg() { - return d.ArgErr() - } - caddy.Log().Named("config.adapter.caddyfile").Warn("DEPRECATED: buffer_requests: use request_buffers instead (with a maximum buffer size)") - h.DeprecatedBufferRequests = true - case "buffer_responses": // TODO: deprecated - if d.NextArg() { - return d.ArgErr() - } - caddy.Log().Named("config.adapter.caddyfile").Warn("DEPRECATED: buffer_responses: use response_buffers instead (with a maximum buffer size)") - h.DeprecatedBufferResponses = true - case "max_buffer_size": // TODO: deprecated - if !d.NextArg() { - return d.ArgErr() - } - size, err := humanize.ParseBytes(d.Val()) - if err != nil { - return d.Errf("invalid byte size '%s': %v", d.Val(), err) - } - if d.NextArg() { - return d.ArgErr() - } - caddy.Log().Named("config.adapter.caddyfile").Warn("DEPRECATED: max_buffer_size: use request_buffers and/or response_buffers instead (with maximum buffer sizes)") - h.DeprecatedMaxBufferSize = int64(size) - case "stream_timeout": if !d.NextArg() { return d.ArgErr() diff --git a/modules/caddyhttp/reverseproxy/reverseproxy.go b/modules/caddyhttp/reverseproxy/reverseproxy.go index 980e259c..1a559e5d 100644 --- a/modules/caddyhttp/reverseproxy/reverseproxy.go +++ b/modules/caddyhttp/reverseproxy/reverseproxy.go @@ -129,15 +129,6 @@ type Handler struct { // are also set implicitly. Headers *headers.Handler `json:"headers,omitempty"` - // DEPRECATED: Do not use; will be removed. See request_buffers instead. - DeprecatedBufferRequests bool `json:"buffer_requests,omitempty"` - - // DEPRECATED: Do not use; will be removed. See response_buffers instead. - DeprecatedBufferResponses bool `json:"buffer_responses,omitempty"` - - // DEPRECATED: Do not use; will be removed. See request_buffers and response_buffers instead. - DeprecatedMaxBufferSize int64 `json:"max_buffer_size,omitempty"` - // If nonzero, the entire request body up to this size will be read // and buffered in memory before being proxied to the backend. This // should be avoided if at all possible for performance reasons, but @@ -241,17 +232,6 @@ func (h *Handler) Provision(ctx caddy.Context) error { h.connections = make(map[io.ReadWriteCloser]openConnection) h.connectionsMu = new(sync.Mutex) - // TODO: remove deprecated fields sometime after v2.6.4 - if h.DeprecatedBufferRequests { - h.logger.Warn("DEPRECATED: buffer_requests: this property will be removed soon; use request_buffers instead (and set a maximum buffer size)") - } - if h.DeprecatedBufferResponses { - h.logger.Warn("DEPRECATED: buffer_responses: this property will be removed soon; use response_buffers instead (and set a maximum buffer size)") - } - if h.DeprecatedMaxBufferSize != 0 { - h.logger.Warn("DEPRECATED: max_buffer_size: this property will be removed soon; use request_buffers and/or response_buffers instead (and set maximum buffer sizes)") - } - // warn about unsafe buffering config if h.RequestBuffers == -1 || h.ResponseBuffers == -1 { h.logger.Warn("UNLIMITED BUFFERING: buffering is enabled without any cap on buffer size, which can result in OOM crashes")