Files
brave-core/components/api_request_helper
Jocelyn Liu 6559f9df89 Support lines split across chunks in api_request_helper's ParseSSE (#33926)
Currently ParseSSE splits each incoming chunk into lines independently,
but network chunks don't always align with SSE line boundaries. When a
line is split across chunks, usually happens when the event is large,
the first fragment produces invalid JSON and later fragments are dropped
due to not starting with "data: {" prefix.

This commit replaces base::SplitStringPiece with incremental line
scanning, each complete line is handed to the new ProcessSSELine helper
and processed the same as before. Partial lines missing line breaks are
buffered in |sse_line_buffer_| until a line ending completes them in the
next chunk.

Also clears |sse_line_buffer_| on retry and completion.
2026-02-13 04:02:11 -08:00
..