Skip to content

Fix curl transport parsing of X-Sentry-Rate-Limits header #1111

Closed

Description

@szokeasaurusrex

The curl transport parses raw response header lines with data.split(':') and stores only the first segment after the header name. This truncates X-Sentry-Rate-Limits values, whose documented format is retry_after:categories:scope:reason_code:namespaces:.... For example, X-Sentry-Rate-Limits: 120:error:project is passed to RateLimiter::update_from_sentry_header as only 120, so the parser ignores it and the SDK does not apply the rate limit. Because the header variable is still Some, the current else if chain also skips Retry-After and bare 429 fallback handling. See curl.rs, ratelimit.rs, and the Sentry SDK rate limiting docs.

We should fix the curl header parsing to preserve the complete value after the first colon, for example with split_once(':') or splitn(2, ':'). We should also add a regression test that exercises a raw curl-style header line such as X-Sentry-Rate-Limits: 120:error:project and verifies that the complete value reaches the rate limiter. A small helper for parsing header lines would make this straightforward to unit test without requiring a curl-backed integration server.

Activity

  1. linear-code commented on May 5, 2026

    @linear-code
  2. added
    Rust
    Bug
    on May 5, 2026
  3. added
    Bug
    and removed
    Bug
    on Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugRust

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions