Skip to content

Commit

Permalink
Use already pre existing reponse header to do websocket handshake
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumelamirand committed Sep 19, 2024
1 parent d1fee49 commit c3c6357
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.http.HttpHeaders;
import io.netty.handler.codec.http.HttpResponseStatus;
import io.netty.handler.codec.http.websocketx.WebSocketServerHandshaker;
import io.vertx.core.AsyncResult;
Expand Down Expand Up @@ -189,7 +190,7 @@ private void doHandshake() {
Channel channel = conn.channel();
Http1xServerResponse response = request.response();
try {
handshaker.handshake(channel, request.nettyRequest());
handshaker.handshake(channel, request.nettyRequest(), (HttpHeaders) response.headers(), channel.newPromise());
} catch (Exception e) {
response.setStatusCode(BAD_REQUEST.code()).end();
throw e;
Expand Down

0 comments on commit c3c6357

Please sign in to comment.