Skip to content

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

@szokeasaurusrex

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingRustSDK
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions