Skip to content

Conversation

@AlexProgrammerDE
Copy link

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.
Copy link
Contributor

@jrhee17 jrhee17 left a comment

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
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
Copy link
Contributor

@jrhee17 jrhee17 left a comment

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
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
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
Copy link
Contributor

jrhee17 commented Apr 16, 2025

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

@AlexProgrammerDE
Copy link
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
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