Skip to content
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

Add CONNECT constant to HttpMethod #34195

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

Conversation

v-perfilev
Copy link
Contributor

@v-perfilev v-perfilev commented Jan 4, 2025

While reviewing issue #34044, I noticed that the HttpMethod class does not include a constant for the HTTP method CONNECT, which was introduced in RFC 7231. This PR adds the CONNECT constant to the HttpMethod class and updates the test class HttpMethodTests.

Changes in other files:

  • CONNECT method excluded in initAllowedHttpMethods of RequestMappingInfoHandlerMapping and in initAllowHeader of WebContentGenerator.

  • CONNECT method is not supported by HttpComponentsClientHttpConnector and JdkClientHttpConnector, so ClientHttpConnectorTests was updated to dynamically skip CONNECT for these connectors.

  • CONNECT method is primarily used for establishing tunnels, so it is not relevant for RequestMethod class and was excluded from RequestMethodTests.

These changes prepare the repository for a follow-up PR addressing issue #34044, where a conditional check will be introduced for WebSocket handshakes: if the HTTP version is HTTP/2 the method must be CONNECT, as specified in RFC 8441, otherwise it should be GET.

Replaced outdated references to HTTP 1.1 section links (RFC 2616)
with updated references to RFC 9110. The original document
has been superseded.
Introduced a new constant CONNECT with reference to RFC 9110.
Updated values array and valueOf method.
Modified the values test in HttpMethodTests to include
the CONNECT method.
The CONNECT method is not supported by HttpComponentsClientHttpConnector
and JdkClientHttpConnector.
The CONNECT http method is primarily used for establishing tunnels
and is not relevant for RequestMethod.
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 4, 2025
Updated initAllowedHttpMethods in WebContentGenerator and
RequestMappingInfoHandlerMapping to explicitly exclude the CONNECT
method.
@snicoll
Copy link
Member

snicoll commented Jan 6, 2025

Additionally the documentation references for existing constants in HttpMethod have been updated to point to the RFC 9110, as the previous links referenced a superseded document.

Please revert, this is unrelated to your proposal of adding CONNECT.

This reverts commit 5489d56 as it is unrelated to the addition
of CONNECT to HttpMethod.
@v-perfilev v-perfilev force-pushed the connnect-httpmethod-support branch from 822c6cf to 9a1a181 Compare January 6, 2025 09:41
@v-perfilev
Copy link
Contributor Author

Hello @snicoll !

Done: the commit with link updates has been reverted as requested.

  1. Would you like me to create a separate PR for this change, or should I leave it for now?
  2. Do the same 55-character length rule apply to revert commit messages?

@snicoll
Copy link
Member

snicoll commented Jan 6, 2025

Let's see where this PR leads us and we can revisit the other change. The rule (not sure where that comes from) is irrelevant as your commits are going to be squashed if we merge this.

@v-perfilev
Copy link
Contributor Author

@snicoll
Okay, I got it.
This rule comes from CONTRIBUTING.md:

Format commit messages using 55 characters for the subject line, 72 characters per line for the description.

@bclozel bclozel added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: waiting-for-triage An issue we've not yet triaged or decided on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants