Skip to content

Forbid or replace empty targets in HTTP/1.1 requests #469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ruslandoga
Copy link
Contributor

@ruslandoga ruslandoga commented Aug 7, 2025

👋

Right now Mint allows sending empty target in the request line for HTTP/1.1. I think it should either forbid such requests or replace them with /:

If the target URI's path component is
empty, the client MUST send "/" as the path within the origin-form of
request-target.

Current behaviour

Mint.HTTP1.request(conn, "POST", _path = "", headers, body)

this results in POST HTTP/1.1

475595741-7dd92fd2-9c97-424a-ad20-ece2c075e345

This PR

Forbidding seems easier since replacing "" with "/" might be surprising and not always correct, and there is already a :skip_target_validation option to disable "forbidding" if necessary.

@ruslandoga ruslandoga changed the title add failing test Forbid or replace empty targets in HTTP/1.1 requests Aug 7, 2025
@ruslandoga ruslandoga marked this pull request as ready for review August 7, 2025 17:11
@whatyouhide
Copy link
Contributor

@ruslandoga can we add a test that verifies the behavior of this with :skip_target_validation?

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.

2 participants