Skip to content

refuse empty request-target in HTTP request - #3255

Merged
benoitc merged 1 commit into
benoitc:masterfrom
pajod:patch-refuse-empty-request-target
Aug 6, 2024
Merged

benoitc merged 1 commit into
benoitc:masterfrom
pajod:patch-refuse-empty-request-target

Conversation

@pajod

@pajod pajod commented Jul 31, 2024

Copy link
Copy Markdown
Contributor

The shortest origin-form is a single slash, not empty. So refuse request lines that have two consecutive spaces where the URI should be. There should be something there.

Python stdlib explicitly tells us it will not perform validation - and neither does this patch! This patch merely closes the one trivial hole that is of special interest, as it might confuse setups involving proxies and pipe-lining.

A single slash is valid, but nothing at all can be safely refused.

Python stdlib explicitly tells us it will not perform validation.
https://docs.python.org/3/library/urllib.parse.html#url-parsing-security
There are *four* `request-target` forms in rfc9112, none of them can be empty.
@benoitc
benoitc merged commit 5c0e157 into benoitc:master Aug 6, 2024
@benoitc

benoitc commented Aug 6, 2024

Copy link
Copy Markdown
Owner

LFTM. thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gunicorn accepts requests with empty URIs

2 participants