Merge pull request #3601 from benoitc/test/rfc9110-body-framing-fixtures

test: codify body-framing cases (RFC 9110 §8.6 & RFC 9112 §6.1)
This commit is contained in:
Benoit Chesneau 2026-04-19 20:46:25 +02:00 committed by GitHub
commit 4da46edac0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,5 @@
GET /foo HTTP/1.1\r\n
Host: example.com\r\n
Content-Length: 5\r\n
\r\n
hello

View File

@ -0,0 +1,16 @@
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9110 section 8.6: a GET with a non-zero Content-Length is
# "discouraged" but not forbidden; the body must be preserved.
request = {
"method": "GET",
"uri": uri("/foo"),
"version": (1, 1),
"headers": [
("HOST", "example.com"),
("CONTENT-LENGTH", "5"),
],
"body": b"hello",
}

View File

@ -0,0 +1,4 @@
GET /foo HTTP/1.1\r\n
Host: example.com\r\n
Content-Length: 0\r\n
\r\n

View File

@ -0,0 +1,15 @@
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9110 section 8.6: Content-Length: 0 on GET is valid.
request = {
"method": "GET",
"uri": uri("/foo"),
"version": (1, 1),
"headers": [
("HOST", "example.com"),
("CONTENT-LENGTH", "0"),
],
"body": b"",
}

View File

@ -0,0 +1,5 @@
POST /foo HTTP/1.0\r\n
Host: example.com\r\n
Content-Length: 5\r\n
\r\n
hello

View File

@ -0,0 +1,16 @@
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9112 section 6.1: Content-Length is the only framing option for
# HTTP/1.0 bodies (chunked was added in HTTP/1.1).
request = {
"method": "POST",
"uri": uri("/foo"),
"version": (1, 0),
"headers": [
("HOST", "example.com"),
("CONTENT-LENGTH", "5"),
],
"body": b"hello",
}