[PATCH|PULL 0/2] chunked: limit to HTTP/1.1, undeprecate

20 views
Skip to first unread message

Eric Wong

unread,
Sep 1, 2022, 5:45:39 PM9/1/22
to rack-...@googlegroups.com
Lets reduce the pain on end users upgrading to Rack 3.
HTTP/1.0 and HTTP/1.1 aren't going away, and I was dealing
with HTTP/0.9 until 2017.

Fwiw, probably 95% of people and organizations I know have
given up on Ruby due to constant treadmill of upgrades and
incompatibilities, so avoid giving them more reason to give
up Ruby due to more incompatibilities.

The following changes since commit 6aad5390403ca48a0ba76e426a21274385895731:

The stream argument must implement `#<<`. (#1959) (2022-08-31 14:31:46 +1200)

are available in the Git repository at:

https://80x24.org/rack.git chunk

for you to fetch changes up to e3945c3acc5a6e8d3af4cc8639dcb12fb85a8aee:

chunked: remove deprecation warning (2022-09-01 21:34:23 +0000)

----------------------------------------------------------------
Eric Wong (2):
chunked: limit to HTTP/1.1
chunked: remove deprecation warning

lib/rack/chunked.rb | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)

Eric Wong

unread,
Sep 1, 2022, 5:45:41 PM9/1/22
to rack-...@googlegroups.com
895beec0622d (chunked: do not chunk on pre-HTTP/1.0 clients, 2013-11-12)
was written in 2013 in anticipation of HTTP/1.2 and future versions
supporting chunked encoding. As of 2022, HTTP/1.2 is yet to happen,
and is unlikely given HTTP/2 and HTTP/3 both exist. So limit
chunking to HTTP/1.1, since HTTP/1.x will remain in use for years
to come, and there's still a few odd places using HTTP/0.9.
---
lib/rack/chunked.rb | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/lib/rack/chunked.rb b/lib/rack/chunked.rb
index 47fb36ac..004163d9 100644
--- a/lib/rack/chunked.rb
+++ b/lib/rack/chunked.rb
@@ -83,16 +83,9 @@ module Rack
@app = app
end

- # Whether the HTTP version supports chunked encoding (HTTP 1.1 does).
+ # Whether the HTTP version supports chunked encoding (only HTTP 1.1 does).
def chunkable_version?(ver)
- case ver
- # pre-HTTP/1.0 (informally "HTTP/0.9") HTTP requests did not have
- # a version (nor response headers)
- when 'HTTP/1.0', nil, 'HTTP/0.9'
- false
- else
- true
- end
+ ver == 'HTTP/1.1' # HTTP/2 doesn't, and HTTP/1.2 is unlikely
end

# If the rack app returns a response that should have a body,

Eric Wong

unread,
Sep 1, 2022, 5:45:43 PM9/1/22
to rack-...@googlegroups.com
Now that Rack::Chunked is gracefully a no-op for non-1.1 HTTP
versions, do not cause unnecessary pain for end users upgrading
to Rack 3.
---
lib/rack/chunked.rb | 2 --
1 file changed, 2 deletions(-)

diff --git a/lib/rack/chunked.rb b/lib/rack/chunked.rb
index 004163d9..b66f467b 100644
--- a/lib/rack/chunked.rb
+++ b/lib/rack/chunked.rb
@@ -4,8 +4,6 @@ require_relative 'constants'
require_relative 'utils'

module Rack
- warn "Rack::Chunked is deprecated and will be removed in Rack 3.1", uplevel: 1
-
# Middleware that applies chunked transfer encoding to response bodies
# when the response does not include a content-length header.
#
Reply all
Reply to author
Forward
0 new messages