Issue with netty websocket headers name in lowercase
123 views
Skip to first unread message
Subhadeep Sen
unread,
May 23, 2018, 1:51:04 AM5/23/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Netty discussions
Hello, I am using netty to implement a websocket server. The server needs to work with some old websocket clients libraries (written in other languages) out there which does not honour the HTTP header case insensitivity rule. I am facing a problem there.
My inbound channel pipeline is pretty standard which looks like following HttpServerCodec -> HttpObjectAggregator -> HttpRequestBuilder ->WebSocketServerProtocolHandler -> WebSocketFrameAggregator -> CustomHandler
In netty version 4.1.23.Final I see that the websocket handshake response being sent to client is all in lowercase header names, like following.
As a result the websocket connection does not complete. Has anybody faced this problem?
The header strings are coming from HttpHeaderNames class instead of HttpHeader class. The fix is to change WebSocketServerHandshaker13.newHandshakeResponse() to use the required HttpHeader. But that would need change in netty code itself probably . Can somebody suggest any cleaner way to get around this problem without changing netty code?
1. Is there anyway to add/modify http response header while using the existing netty websocket handshaker classes? 2. Should I write custom WebSocketServerProtocolHandler to achieve the same? 3. Any other way?