gin
gin copied to clipboard
perf: use textproto.TrimString for HTTP header parsing to improve performance
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.