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

Fix for IBM websockets connection chunking issue #12

Merged
merged 2 commits into from
Mar 13, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@
import org.apache.qpid.proton.engine.impl.TransportOutput;
import org.apache.qpid.proton.engine.impl.TransportWrapper;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class WebSocketImpl implements WebSocket, TransportLayer {
private static final Logger TRACE_LOGGER = LoggerFactory.getLogger(WebSocketImpl.class);

private int maxFrameSize = (4 * 1024) + (16 * WebSocketHeader.MED_HEADER_LENGTH_MASKED);
private boolean tailClosed = false;
private final ByteBuffer inputBuffer;
Expand Down Expand Up @@ -275,8 +280,13 @@ private boolean sendToUnderlyingInput() {
private void processInput() throws TransportException {
switch (webSocketState) {
case PN_WS_CONNECTING:
inputBuffer.mark();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing the issue. Can you please add a unit test which verifies the fix?

if (webSocketHandler.validateUpgradeReply(inputBuffer)) {
webSocketState = WebSocketState.PN_WS_CONNECTED_FLOW;
} else {
// Input data was incomplete. Reset buffer position and wait for another call after more data arrives.
inputBuffer.reset();
TRACE_LOGGER.warn("Websocket connecting response incomplete");
}
inputBuffer.compact();
break;
Expand Down