Damien Neil submitted this change.
6 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
net/http/httpproxy: support non-ASCII characters in NO_PROXY
Change-Id: I4b3a97a2046fcc2619535a508c9d71ffa4ca75df
GitHub-Last-Rev: 5e2316523ccaa29273e68b9c12e50f2fce36967c
GitHub-Pull-Request: golang/net#105
Reviewed-on: https://go-review.googlesource.com/c/net/+/326269
Reviewed-by: Brad Fitzpatrick <brad...@golang.org>
Trust: Brad Fitzpatrick <brad...@golang.org>
Trust: Damien Neil <dn...@google.com>
Run-TryBot: Damien Neil <dn...@google.com>
TryBot-Result: Gopher Robot <go...@golang.org>
---
M http/httpproxy/proxy.go
M http/httpproxy/proxy_test.go
2 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/http/httpproxy/proxy.go b/http/httpproxy/proxy.go
index d2c8c87..16994ac 100644
--- a/http/httpproxy/proxy.go
+++ b/http/httpproxy/proxy.go
@@ -267,6 +267,9 @@
matchHost = true
phost = "." + phost
}
+ if v, err := idnaASCII(phost); err == nil {
+ phost = v
+ }
c.domainMatchers = append(c.domainMatchers, domainMatch{host: phost, port: pport, matchHost: matchHost})
}
}
diff --git a/http/httpproxy/proxy_test.go b/http/httpproxy/proxy_test.go
index 2a12dad..d763732 100644
--- a/http/httpproxy/proxy_test.go
+++ b/http/httpproxy/proxy_test.go
@@ -178,7 +178,29 @@
},
req: "http://example.com/",
want: "http://proxy",
-}}
+}, {
+ cfg: httpproxy.Config{
+ NoProxy: ".示例.com",
+ HTTPProxy: "proxy",
+ },
+ req: "http://www.示例.com",
+ want: "<nil>",
+}, {
+ cfg: httpproxy.Config{
+ NoProxy: "xn--fsq092h.com",
+ HTTPProxy: "proxy",
+ },
+ req: "http://www.示例.com",
+ want: "<nil>",
+}, {
+ cfg: httpproxy.Config{
+ NoProxy: "示例.com",
+ HTTPProxy: "proxy",
+ },
+ req: "http://www.xn--fsq092h.com",
+ want: "<nil>",
+},
+}
func testProxyForURL(t *testing.T, tt proxyForURLTest) {
setHelper(t)
To view, visit change 326269. To unsubscribe, or for help writing mail filters, visit settings.