Skip to content

Fix Lint: allow lowercase and special chars in REQUEST_METHOD#726

Open
kimjune01 wants to merge 1 commit into
plack:masterfrom
kimjune01:fix-lint-lowercase-method
Open

Fix Lint: allow lowercase and special chars in REQUEST_METHOD#726
kimjune01 wants to merge 1 commit into
plack:masterfrom
kimjune01:fix-lint-lowercase-method

Conversation

@kimjune01
Copy link
Copy Markdown

Summary

  • Updated the REQUEST_METHOD validation regex from /^[A-Z]+$/ to RFC 9110 tchar to accept lowercase methods, digits, and other valid token characters
  • The previous check was over-restrictive: RFC 9110 Section 9.1 defines method as a token, which permits characters beyond uppercase ASCII letters

Fixes #588

Test plan

  • prove -Ilib t/Plack-Middleware/lint_env.t passes (12/12 tests)
  • Tests cover lowercase (get), mixed case (myMethod), hyphenated (X-Custom), and empty string (rejected)

Middleware::Lint was incorrectly rejecting valid HTTP method tokens
that contained lowercase letters or special characters. RFC 7231
section 4.1 defines method tokens as case-sensitive sequences of
tchar (RFC 7230 section 3.2.6), which includes A-Z, a-z, 0-9, and
!#$%&'*+-.^_`|~.

This fix updates the REQUEST_METHOD validation regex to accept all
valid tchar sequences, allowing methods like "get", "GeT", and
"my-custom-method".

Fixes plack#588
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.

Middleware::Lint rejects non-uppercase method tokens

1 participant