gin icon indicating copy to clipboard operation
gin copied to clipboard

perf: use textproto.TrimString for HTTP header parsing to improve performance

Open 1911860538 opened this issue 5 months ago • 2 comments
trafficstars

Replaced strings.TrimSpace with textproto.TrimString in HTTP header parsing functions to improve performance and better align with HTTP spec.
textproto.TrimString, which is widely used in net/http, trims only ASCII whitespace—making it both sufficient and more efficient for HTTP headers like X-Forwarded-For and Accept.

1911860538 avatar Jun 03 '25 12:06 1911860538