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

Data is truncated when using WebSocket to transfer data over 128k #100

Open
harryhdk opened this issue Jul 30, 2021 · 2 comments
Open

Data is truncated when using WebSocket to transfer data over 128k #100

harryhdk opened this issue Jul 30, 2021 · 2 comments

Comments

@harryhdk
Copy link

version:1.4.5
protocol :websocket

When the amount of data over 128K, slot "newMessage" can only receive most of the data. I found the last part of the data is in priv->payload, so I modified the code.

websocket.cpp

if (priv->frame.fin()) {
        // FINAL
        if (priv->frame.isControlFrame()) {
            evaluateControlFrame();
        } else {
            if (priv->frame.opcode() == FrameType::CONTINUATION) {
                // CONTINUATION
                QByteArray chunk(priv->fragment);
                chunk.append(priv->payload); // add this line,  the last part of data
                priv->fragment.clear();
                priv->payload.clear();  // also clear
                emit newMessage(chunk);
            } else {
                // NON-CONTINUATION
                QByteArray chunk(priv->payload);
                priv->payload.clear();
                emit newMessage(chunk);
            }
        }
    } 

It seems that everything is ok
Please help to check whether this modification is feasible,thanks

@vinipsmaker
Copy link
Owner

Looks good to me. Do you want to create a PR?

@harryhdk
Copy link
Author

harryhdk commented Aug 9, 2021

Looks good to me. Do you want to create a PR?

glad to,thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants