aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/httputil/reverseproxy.go
diff options
context:
space:
mode:
authorapocelipes <seve3r@outlook.com>2025-02-05 00:37:18 +0000
committerGopher Robot <gobot@golang.org>2025-02-04 17:20:47 -0800
commita1ea78c470d3136b7aed42a4d8b94497563f98ea (patch)
treeeeff0948e18d8ac6087b9120f0be65ab64fd13af /src/net/http/httputil/reverseproxy.go
parent0e35fb2f99ce4c249c0a42ad93a597835ae742b5 (diff)
downloadgo-a1ea78c470d3136b7aed42a4d8b94497563f98ea.tar.xz
net: use strings.SplitSeq and bytes.SplitSeq
Replace `for _, s := range {strings, bytes}.Split(v, sep)` with `for s := range {strings, bytes}.SplitSeq(v, sep)`, to simplify the code and reduce some memory allocations. Change-Id: Idead4de1e3928fc75cc5ba8caeff85542f1243d5 GitHub-Last-Rev: 5fb196a073e7583b23b1ebb446d6c067580ed63a GitHub-Pull-Request: golang/go#71554 Reviewed-on: https://go-review.googlesource.com/c/go/+/646216 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/net/http/httputil/reverseproxy.go')
-rw-r--r--src/net/http/httputil/reverseproxy.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/net/http/httputil/reverseproxy.go b/src/net/http/httputil/reverseproxy.go
index d64d2fc3a1..15e9684708 100644
--- a/src/net/http/httputil/reverseproxy.go
+++ b/src/net/http/httputil/reverseproxy.go
@@ -577,7 +577,7 @@ func shouldPanicOnCopyError(req *http.Request) bool {
func removeHopByHopHeaders(h http.Header) {
// RFC 7230, section 6.1: Remove headers listed in the "Connection" header.
for _, f := range h["Connection"] {
- for _, sf := range strings.Split(f, ",") {
+ for sf := range strings.SplitSeq(f, ",") {
if sf = textproto.TrimString(sf); sf != "" {
h.Del(sf)
}