Skip to content

Do not reject UNKNOWN HttpMethod#6172

Open
AlexProgrammerDE wants to merge 6 commits into
line:mainfrom
AlexProgrammerDE:feature/unknown-method-header
Open

Do not reject UNKNOWN HttpMethod#6172
AlexProgrammerDE wants to merge 6 commits into
line:mainfrom
AlexProgrammerDE:feature/unknown-method-header

Conversation

@AlexProgrammerDE

Copy link
Copy Markdown

Motivation:

Adds unknown HTTP Methods from other RFCs.
I need this feature because WebDav extends the list of HTTP Method names and Http1RequestDecoder rejects unknown method names.
More information in the Discord: https://canary.discord.com/channels/1087271586832318494/1087272728177942629/1351931184451686420

Modifications:

  • Stopped rejecting UNKNOWN HTTP Methods
  • Use the METHOD header as the method passed to Tomcat.

Result:

  • Users will now be able to use more HTTP Methods for even more use-cases like WebDav.

Also makes Tomcat use the METHOD header.
Jetty already uses the METHOD header.

@jrhee17 jrhee17 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Direction looks good.

I'm not sure if you want to handle here as well, but client-side won't be able to send custom HTTP methods. We can keep this as a known issue and proceed with server-side first though

// Set the method.
final HttpMethod method = req.method();
coyoteReq.method().setString(method.name());
coyoteReq.method().setString(req.headers().get(HttpHeaderNames.METHOD));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add a integration test which validates the server can successfully process the custom http method?

@jrhee17 jrhee17 added this to the 1.33.0 milestone Mar 25, 2025

@jrhee17 jrhee17 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me once the CI is fixed 👍

One more note is the current approach is more of a workaround due to breaking changes - later we may allow registration of custom HttpMethods in a type-safe way when we bump the major version

*
* @param additionalAllowedHttpMethods the additional allowed HTTP methods
*/
public ServerBuilder additionalAllowedHttpMethods(String... additionalAllowedHttpMethods) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional) for consistency with other APIs, it may be worth adding a additionalAllowedHttpMethods(Iterable<String>) variant

// Set the method.
final HttpMethod method = req.method();
coyoteReq.method().setString(method.name());
coyoteReq.method().setString(req.headers().get(HttpHeaderNames.METHOD));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: I think it's fine to support just tomcat for now, and add support for jetty later if needed/reported

@jrhee17

jrhee17 commented Apr 16, 2025

Copy link
Copy Markdown
Contributor

Gentle ping. We could also finish this implementation if you are busy @AlexProgrammerDE

@AlexProgrammerDE

Copy link
Copy Markdown
Author

Hi, university started for me, so I'm a little more busy than usual. I'd appreciate if the team could finish this.

@github-actions github-actions Bot added the Stale label May 17, 2025
@ikhoon ikhoon modified the milestones: 1.33.0, 1.34.0 Aug 1, 2025
@github-actions github-actions Bot removed the Stale label Aug 2, 2025
@github-actions github-actions Bot added the Stale label Sep 1, 2025
@jrhee17 jrhee17 modified the milestones: 1.34.0, 1.35.0 Nov 24, 2025
@github-actions github-actions Bot removed the Stale label Nov 25, 2025
@github-actions github-actions Bot added the Stale label Dec 28, 2025
@minwoox minwoox modified the milestones: 1.35.0, 1.36.0 Dec 30, 2025
@github-actions github-actions Bot removed the Stale label Dec 31, 2025
@github-actions github-actions Bot added the Stale label Jan 30, 2026
@ikhoon ikhoon modified the milestones: 1.36.0, 1.37.0 Feb 2, 2026
@github-actions github-actions Bot removed the Stale label Feb 3, 2026
@github-actions github-actions Bot added the Stale label Mar 7, 2026
@ikhoon ikhoon modified the milestones: 1.38.0, 2.0.0, 1.39.0 Apr 3, 2026
@github-actions github-actions Bot removed the Stale label Apr 4, 2026
@github-actions github-actions Bot added the Stale label May 7, 2026
@minwoox minwoox modified the milestones: 1.39.0, 1.40.0 May 8, 2026
@github-actions github-actions Bot removed the Stale label May 9, 2026
@jrhee17 jrhee17 modified the milestones: 1.40.0, 1.41.0 Jun 10, 2026
@github-actions github-actions Bot added the Stale label Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants