Skip to content

curl_ws_meta.md: polish and better vocabulary#22233

Closed
bagder wants to merge 3 commits into
masterfrom
bagder/ws-meta
Closed

curl_ws_meta.md: polish and better vocabulary#22233
bagder wants to merge 3 commits into
masterfrom
bagder/ws-meta

Conversation

@bagder

@bagder bagder commented Jul 1, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Polishes the curl_ws_meta(3) manpage wording and formatting, clarifying how to interpret metadata for received WebSocket data.

Changes:

  • Reflows the DESCRIPTION paragraph for better readability.
  • Adds an explanatory paragraph distinguishing WebSocket frames from libcurl-delivered chunks.
  • Updates terminology in bytesleft and CURLWS_CONT sections from “fragment” to “frame”.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/libcurl/curl_ws_meta.md Outdated
@bagder bagder marked this pull request as ready for review July 1, 2026 08:06
@bagder

bagder commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

@HendrikHuebner does it clarify enough? Is it still vague in some area?

@HendrikHuebner

Copy link
Copy Markdown

That's definitely clearer. Additionally, I'd like to see clarification on whether the buffer libcurl provides to the write callback can contain multiple chunks from different frames, and how the application must handle this.

For example, if we receive two frames in quick succession, curl presumably buffers these before dispatching the write callback. In my application I observed this scenario, where meta->len was smaller than nmemb (the number of bytes in the receive buffer). This suggests, that the buffer contained more than one chunk, and I handled this by returning the number of consumed bytes meta->len.

@bagder

bagder commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

Added:

Each callback delivers data for a single chunk that is then part of a single frame.

if we receive two frames in quick succession, curl presumably buffers these before dispatching the write callback

Not likely. It delivers the first callback and then it reuses buffers internally and calls the callback again with the next chunk, probably using the same memory area as for the previous callback. An application cannot assume anything else at least.

In my application I observed this scenario, where meta->len was smaller than nmemb (the number of bytes in the receive buffer). This suggests, that the buffer contained more than one chunk

It suggests the buffer contains data after the chunk, yes. Right now I can't recall why it would do that...

Assisted-by: Hendrik Hübner
Closes #22233
@HendrikHuebner

Copy link
Copy Markdown

Right, I'll try to investigate in my application, but at least it seems like the shape is generally correct already.

Maybe @icing knows, whether nmemb > meta->len is expected behavior?

The other problem from my original issue is that I observed strange values for len and offset, after pausing in the write callback. I'll create another issue with a reproducer once I'm confident that it's not some obvious problem with my code.

@bagder bagder closed this in 5bf1ce6 Jul 1, 2026
@bagder bagder deleted the bagder/ws-meta branch July 1, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants