Make #flush in WebSocket#stream a no-op to not send wrongly frames#16539
Make #flush in WebSocket#stream a no-op to not send wrongly frames#16539ysbaddaden merged 5 commits intocrystal-lang:masterfrom
#flush in WebSocket#stream a no-op to not send wrongly frames#16539Conversation
e4a7485 to
f9000a9
Compare
|
This is changing the behavior of If I'm reading correctly, Now that we have a proper Note: |
|
Unless this is still exposing the same issue: we can receive "DAT" then "A" (flush) then an empty frame with the FIN flag? |
Flush will send From the docs
IMO this is wrong. It will send what's in the buffer and "end" the first message (FIN). But then it doesn't really "reset" the stream, because the opcode will still be |
|
Oh, that explicit documentation makes it hard to simply change this internal type 🙈 The documented behaviour is dodgy and inconsistent. It generally doesn't make much sense, per #16532 (comment). I understand the main purpose of The documentation describes On top of that, the implementation in At this point, I would argue we can perhaps disregard the documentation of We could implement |
|
@spuun I understand the issue. I'm proposing that |
|
We can just not implement Or we implement it as merely sending the buffer: def flush : Nil
send_data unless @pos == 0
endI think both are fine. Implementing it might keep some of the current behavior, but I'm not sure there is much value or use cases. |
That's just an empty fin fragment which should be totally fine.
I don't think implement |
|
Then lets just remove the reference to |
Fixes #16532