You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Final middleware sweep for hand-rolled per-byte scanning, each gated
on benchstat (n=10):
- basicauth containsInvalidHeaderChars: replace strings.IndexFunc with
a swar word scan (valid lane = visible ASCII or HTAB); every byte
>= 0x80 is invalid, so byte-wise and rune-wise answers are identical.
199.7ns -> 47.6ns (-76%). Runs on the raw Authorization header before
the credential compare, so constant-time properties are unaffected.
- cache hasDirective: skip between candidates with utils.IndexFold
instead of calling EqualFold at every offset. 497ns -> 98ns (-80%).
Same candidate set: both fold only ASCII letters.
- proxy resolveRedirect: hoist the Location control-byte rejection into
indexControlByte, a swar scan for bytes < 0x20 or DEL (bytes >= 0x80
stay allowed, unchanged).
- static sanitizePath: reject backslashes and NUL in one
utils.IndexAny2 pass instead of two IndexByte scans.
Add direct unit tests covering word/tail/scalar boundaries for the new
scans plus micro-benchmarks for the basicauth and cache ones.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XQHTh1nZDARUPzNDBsba6h
0 commit comments