fix: use the correct context when resolving dnsaddr links
Steven Allen committed
Jun 17, 2020 at 19:44 UTC
84341d0c5a66fdf88278ccfba8f1d9703b8fc8e1
1 file changed
+2
-2
core/corehttp/hostname.go
+2
-2
@@ -124,7 +124,7 @@ func HostnameOption() ServeOption {
124
// Not a whitelisted path
125
126
// Try DNSLink, if it was not explicitly disabled for the hostname
127
- if !gw.NoDNSLink && isDNSLinkRequest(n.Context(), coreApi, r) {
127
+ if !gw.NoDNSLink && isDNSLinkRequest(r.Context(), coreApi, r) {
128
// rewrite path and handle as DNSLink
129
r.URL.Path = "/ipns/" + stripPort(r.Host) + r.URL.Path
130
childMux.ServeHTTP(w, r)
@@ -176,7 +176,7 @@ func HostnameOption() ServeOption {
176
// 1. is wildcard DNSLink enabled (Gateway.NoDNSLink=false)?
177
// 2. does Host header include a fully qualified domain name (FQDN)?
178
// 3. does DNSLink record exist in DNS?
179
- if !cfg.Gateway.NoDNSLink && isDNSLinkRequest(n.Context(), coreApi, r) {
179
+ if !cfg.Gateway.NoDNSLink && isDNSLinkRequest(r.Context(), coreApi, r) {
180
// rewrite path and handle as DNSLink
181
r.URL.Path = "/ipns/" + stripPort(r.Host) + r.URL.Path
182
childMux.ServeHTTP(w, r)