Skip to content

Fix Unicode truncation of HTTP error bodies - #26

Open
agocharbhatia wants to merge 1 commit into
raindrop-ai:mainfrom
agocharbhatia:fix-unicode-error-body-truncation
Open

agocharbhatia wants to merge 1 commit into
raindrop-ai:mainfrom
agocharbhatia:fix-unicode-error-body-truncation

Conversation

@agocharbhatia

Copy link
Copy Markdown

Long HTTP error bodies can panic in the Rust SDK when byte 4096 falls inside a UTF-8 character. This interrupts error reporting and can prevent a retryable response from reaching the next attempt.

Truncate the decoded body in place at the nearest preceding character boundary, retaining the existing 4096-byte limit. The boundary adjustment examines at most three bytes and works on Rust 1.88.

Two HTTP integration regressions cover short/exact-limit bodies, ASCII overflow, every interior cutoff in two-, three-, and four-byte characters, 400/503 status preservation, and a long Unicode 503 followed by a successful retry. Both new tests panic against the unchanged upstream implementation and pass with this fix.

Validation (local mock servers, no live API):

  • Transport suite: 9 passed, also on Rust 1.88.0.
  • All-feature offline integration suites: 135 passed.
  • All-feature unit tests: 48 passed; doctest: 1 passed.
  • Formatting, Clippy with warnings denied, and rustdoc with warnings denied passed.

Parallel unit-test runs hit existing Git-process timing assertions, also reproduced with unchanged upstream source. All 48 pass serially. No timing tests are changed here.

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

Successfully merging this pull request may close these issues.

1 participant