Skip to content

WS: fragmented message stuck if last frame has FIN bit with 0-byte payload #18286

@andriydruk

Description

@andriydruk

I did this

Our server’s WebSocket implementation usually splits long messages into multiple frames and sends them as a fragmented message. After all payload bytes are sent, the server sends one more frame with the FIN bit set but with a 0-byte payload (which seems to be allowed by the RFC).

On the client side (using libcurl), we receive all fragments with the CONT opcode and keep waiting for one more frame — but it never arrives. If the server then starts sending a new message, the client receives both messages combined into one.

I expected the following

libcurl should treat the 0-byte FIN frame as the end of the fragmented message, update its ws_meta state accordingly, and call the CURLOPT_WRITEFUNCTION callback (possibly with a 0-byte payload) to signal message completion.

I’m not sure if delivering an explicit 0-byte callback is the correct approach, but without some form of callback, there’s no way to detect message boundaries in this case.

curl/libcurl version

8.13.0

operating system

Android/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions