jetty / jetty.project

Eclipse Jetty® - Web Container & Clients - supports HTTP/2, HTTP/1.1, HTTP/1.0, websocket, servlets, and more
https://eclipse.dev/jetty
Other
3.86k stars 1.91k forks source link

Issue #12429 - case-insensitive headers for websocket #12441

Closed lachlan-roberts closed 4 days ago

lachlan-roberts commented 2 weeks ago

Issue #12429

Add a new static method HttpFields.asMap(HttpFields fields) and use it everywhere in WebSocket where the HttpFields are converted into a Map<String, List<String>> so that the headers in the map are treated as case-insensitive.

lachlan-roberts commented 2 weeks ago

@gregw @joakime I have changed it so that the HttpFields.asMap decides if the map is modifiable or not. If it is not modifiable it will wrap the HttpFields instead of being backed by a TreeMap, so that any modification to the map is also made to the HttpFields.

I have also reviewed the error handling for the WebSocketCreators, which I found to be incorrect in some places.