Skip to content

Conversation

@leehaut
Copy link
Contributor

@leehaut leehaut commented Oct 30, 2025

Fixes #645

Replace unsafe string concatenation with UriComponentsBuilder to build a normalized, valid URL:

UriComponentsBuilder.fromHttpUrl(baseUrl)
    .path(messageEndpoint)
    .queryParam("sessionId", sessionId)
    .build()
    .toUriString();

Testing

Copy link
Contributor

@Kehrlann Kehrlann left a comment

Choose a reason for hiding this comment

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

Hey @leehaut ! Thanks for your contribution. Could you please apply the same to:

  • WebFluxSseServerTransportProvider
  • HttpServletSseServerTransportProvider

private static final int PORT = TestUtil.findAvailablePort();

private static final String CUSTOM_CONTEXT_PATH = "/";
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: / is not a valid context path, please null or "".

@@ -0,0 +1,119 @@
/*
* Copyright 2024 - 2024 the original author or authors.
Copy link
Contributor

Choose a reason for hiding this comment

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

Use 2025

@Kehrlann Kehrlann self-assigned this Nov 18, 2025
@Kehrlann Kehrlann added the waiting for user Waiting for user feedback or more details label Nov 18, 2025
@leehaut
Copy link
Contributor Author

leehaut commented Nov 19, 2025

Thanks! I've updated both WebFluxSseServerTransportProvider and HttpServletSseServerTransportProvider accordingly. Let me know if you need any further changes.

@Kehrlann Kehrlann added bug Something isn't working and removed waiting for user Waiting for user feedback or more details labels Nov 19, 2025
Copy link
Contributor

@Kehrlann Kehrlann left a comment

Choose a reason for hiding this comment

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

Sorry this comes a bit late, but I'm reluctant to add 300 lines of URL-handling code for what amounts to removing a trailing slash on a string.

Please remove the URI builder, and instead introduce a static method in the transports for trimming the slash:

if (u.endsWith("/")) {
    return u.substring(0, s.length() - 1);
}

It doesn't handle everything but we don't want to sanitize any possible user configuration.

Comment on lines -330 to +346
// for
// WebMVC
// compatibility
// for
// WebMVC
// compatibility
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's put this comment on a single line above, above the code

@Kehrlann Kehrlann added the waiting for user Waiting for user feedback or more details label Nov 19, 2025
Signed-off-by: lance <leehaut@gmail.com>
Signed-off-by: Daniel Garnier-Moiroux <git@garnier.wf>
@Kehrlann
Copy link
Contributor

Thank you for your contribution.

@Kehrlann Kehrlann merged commit 86991c1 into modelcontextprotocol:main Nov 19, 2025
1 check passed
@Kehrlann Kehrlann removed the waiting for user Waiting for user feedback or more details label Nov 19, 2025
@leehaut leehaut deleted the hotfix-lance-4701 branch November 19, 2025 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

2 participants