From 0f2b7ca9f7227e0c9f01ccdd544e4e05ee95192d Mon Sep 17 00:00:00 2001 From: Trinopoty Biswas Date: Thu, 4 Mar 2021 21:12:17 +0530 Subject: [PATCH] Fixed issue in EngineIoSocket related to initial query and headers returning null --- .../main/java/io/socket/engineio/server/EngineIoServer.java | 1 + .../main/java/io/socket/engineio/server/EngineIoSocket.java | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/engine.io-server/src/main/java/io/socket/engineio/server/EngineIoServer.java b/engine.io-server/src/main/java/io/socket/engineio/server/EngineIoServer.java index 5994d6c..fb61182 100644 --- a/engine.io-server/src/main/java/io/socket/engineio/server/EngineIoServer.java +++ b/engine.io-server/src/main/java/io/socket/engineio/server/EngineIoServer.java @@ -186,6 +186,7 @@ private void handshakePolling(HttpServletRequest request, HttpServletResponse re final Transport transport = new Polling(lockObject); socket.init(transport, request); transport.onRequest(request, response); + socket.updateInitialHeadersFromActiveTransport(); mClients.put(sid, socket); socket.once("close", args -> mClients.remove(sid)); diff --git a/engine.io-server/src/main/java/io/socket/engineio/server/EngineIoSocket.java b/engine.io-server/src/main/java/io/socket/engineio/server/EngineIoSocket.java index d2a9ec0..58b2ee7 100644 --- a/engine.io-server/src/main/java/io/socket/engineio/server/EngineIoSocket.java +++ b/engine.io-server/src/main/java/io/socket/engineio/server/EngineIoSocket.java @@ -133,6 +133,11 @@ void init(Transport transport, @SuppressWarnings("unused") HttpServletRequest in onOpen(); } + void updateInitialHeadersFromActiveTransport() { + mInitialQuery = mTransport.getInitialQuery(); + mInitialHeaders = mTransport.getInitialHeaders(); + } + /** * Handle an HTTP request. *