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

jakarta.websocket.Session.getRequestParameterMap() contains the value as key #10734

Closed
johnAtWorking opened this issue Oct 13, 2023 · 2 comments
Assignees
Labels
Bug For general bugs on Jetty side

Comments

@johnAtWorking
Copy link

Jetty version(s)
12.0.2

Jetty Environment
ee10

Java version/vendor (use: java -version)
OpenJDK17U-jre_x64_linux_hotspot-17.0.8.1_1 / Eclipse

OS type/version
Windows 10

Description
I open a websocket like
url = ((window.location.protocol == "https:") ? "wss:" : "ws:") + "//" + window.location.host + path + "ws?pageId=6";
webSocket = new WebSocket(url);

in the controller I will read the parameter "pageId"

@serverendpoint(ContentPaths.websocketPath)
public class WebsocketController implements WebListener
{
@onopen
public void onOpen(final Session session)
{
final var params = session.getRequestParameterMap();
final var list = params.get("pageId");
}
}

The key "pageId" in session.getRequestParameterMap() ist not found. Instead the map contains 6=6.

In think in org.eclipse.jetty.websocket.core.Negotiated.Negotiated(URI, String, boolean, ExtensionStack, String)
the "map.put(field.getValue(), Collections.unmodifiableList(field.getValues()));"
should be " map.put(field.getName(), Collections.unmodifiableList(field.getValues()));"

How to reproduce?

@johnAtWorking johnAtWorking added the Bug For general bugs on Jetty side label Oct 13, 2023
@joakime
Copy link
Contributor

joakime commented Oct 13, 2023

@lachlan-roberts can you look at this?

@lachlan-roberts lachlan-roberts self-assigned this Oct 16, 2023
lachlan-roberts added a commit that referenced this issue Oct 16, 2023
lachlan-roberts added a commit that referenced this issue Oct 18, 2023
Issue #10734 - fix websocket CoreSession getParameterMap
@lachlan-roberts
Copy link
Contributor

Merged fix in PR #10736, will be released with 12.0.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side
Projects
No open projects
Status: ✅ Done
Development

No branches or pull requests

3 participants