You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 81bee0f
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: lib/protocol/http1/connection.rb
+35-16Lines changed: 35 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -1004,7 +1004,7 @@ def read_request_body(method, headers, version = nil)
1004
1004
# - Otherwise, if the `content-length` is present, the body is read until the content length is reached.
1005
1005
# - Otherwise, if `remainder` is true, the body is read until the connection is closed.
1006
1006
#
1007
-
# Framing errors (e.g. `transfer-encoding` in an HTTP/1.0 message, or a request whose final transfer coding is not `chunked`) are rejected and mark the connection as non-persistent, since the remainder of the stream can no longer be delimited reliably.
1007
+
# Framing errors (e.g. `transfer-encoding` in an HTTP/1.0 message, `chunked` applied more than once, or a request whose transfer coding is anything other than exactly `chunked`) are rejected and mark the connection as non-persistent, since the remainder of the stream can no longer be delimited reliably.
1008
1008
#
1009
1009
# @parameter headers [Hash] the headers of the message.
1010
1010
# @parameter remainder [Boolean] whether to read the remainder of the body, i.e. the message is a response which may be delimited by closing the connection.
Copy file name to clipboardExpand all lines: releases.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
## Unreleased
4
4
5
5
- Reject `transfer-encoding` in HTTP/1.0 messages and requests whose final transfer coding is not `chunked` with `BadRequest`, and mark the connection as non-persistent, as required by RFC 9112 for reliable message framing.
6
+
- Reject requests whose `transfer-encoding` is anything other than exactly `chunked` (e.g. `gzip, chunked`), since no other transfer coding is decoded and the application would otherwise receive a still-encoded body. Reject any message that applies `chunked` more than once, including across multiple `transfer-encoding` headers.
Copy file name to clipboardExpand all lines: test/protocol/http1/connection.rb
+76Lines changed: 76 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -214,6 +214,41 @@
214
214
expect(server).not.tobe(:persistent)
215
215
end
216
216
217
+
it"fails with request where chunked is preceded by another transfer-encoding"do
218
+
# RFC 9112 Section 6.1: a server that receives a transfer coding it does not understand SHOULD reject the request, rather than silently handing the application a still-encoded body.
0 commit comments