Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
8a9aa415
Unverified
Commit
8a9aa415
authored
Jul 09, 2018
by
Steven Allen
Committed by
GitHub
Jul 09, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5202 from ipfs/fix/dnslink-recursion-alt
correctly handle multi-hop dnslink resolution
parents
0461716b
6a81c72c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
core/corehttp/gateway_test.go
core/corehttp/gateway_test.go
+4
-1
core/corehttp/ipns_hostname.go
core/corehttp/ipns_hostname.go
+3
-1
No files found.
core/corehttp/gateway_test.go
View file @
8a9aa415
...
...
@@ -40,7 +40,10 @@ func (m mockNamesys) Resolve(ctx context.Context, name string, opts ...nsopts.Re
if
depth
==
nsopts
.
UnlimitedDepth
{
depth
=
math
.
MaxUint64
}
for
depth
>
0
&&
strings
.
HasPrefix
(
name
,
"/ipns/"
)
{
for
strings
.
HasPrefix
(
name
,
"/ipns/"
)
{
if
depth
<=
0
{
return
value
,
namesys
.
ErrResolveRecursion
}
depth
--
var
ok
bool
...
...
core/corehttp/ipns_hostname.go
View file @
8a9aa415
...
...
@@ -7,6 +7,7 @@ import (
"strings"
core
"github.com/ipfs/go-ipfs/core"
namesys
"github.com/ipfs/go-ipfs/namesys"
nsopts
"github.com/ipfs/go-ipfs/namesys/opts"
isd
"gx/ipfs/QmZmmuAXgX73UQmX1jRKjTGmjzq24Jinqkq8vzkBtno4uX/go-is-domain"
...
...
@@ -25,7 +26,8 @@ func IPNSHostnameOption() ServeOption {
host
:=
strings
.
SplitN
(
r
.
Host
,
":"
,
2
)[
0
]
if
len
(
host
)
>
0
&&
isd
.
IsDomain
(
host
)
{
name
:=
"/ipns/"
+
host
if
_
,
err
:=
n
.
Namesys
.
Resolve
(
ctx
,
name
,
nsopts
.
Depth
(
1
));
err
==
nil
{
_
,
err
:=
n
.
Namesys
.
Resolve
(
ctx
,
name
,
nsopts
.
Depth
(
1
))
if
err
==
nil
||
err
==
namesys
.
ErrResolveRecursion
{
r
.
Header
.
Set
(
"X-Ipns-Original-Path"
,
r
.
URL
.
Path
)
r
.
URL
.
Path
=
name
+
r
.
URL
.
Path
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment