Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return 404 Not Found for failed path resolutions #3777

Merged
merged 2 commits into from
Mar 23, 2017

Conversation

ghost
Copy link

@ghost ghost commented Mar 11, 2017

Fixes #2286 -- bonus: also kills gateway's namesys dependency

But: I just noticed that the CLI assumes "command not found" for 404 responses. Great.

@ghost ghost added topic/api Topic api topic/gateway Topic gateway labels Mar 11, 2017
@ghost ghost requested review from whyrusleeping and Kubuxu March 11, 2017 04:07
@ghost ghost added the status/in-progress In progress label Mar 11, 2017
return
}
fallthrough
default:
// all other erros
webError(w, "Path Resolve error", err, http.StatusBadRequest)
webError(w, "ipfs cat "+urlPath, err, http.StatusNotFound)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should mention error here. HTTP codes are hidden in browser.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The printed message contains err, so it's gonna be something like: "ipfs cat /ipns/foo.com: Could not resolve name"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, I have missed that.

@whyrusleeping
Copy link
Member

@lgierth So running ipfs dns DoesNotExist.not.a.domain will return 'command not found' ?

@ghost
Copy link
Author

ghost commented Mar 16, 2017

Note: I'll amend this to return a different error "Code" in the response, instead of hijacking the http status code.

License: MIT
Signed-off-by: Lars Gierth <[email protected]>
@ghost ghost force-pushed the fix/gateway-status-codes branch from bf53b2a to 38504d1 Compare March 17, 2017 03:11
@ghost ghost force-pushed the fix/gateway-status-codes branch from 38504d1 to 807ffb9 Compare March 17, 2017 03:17
@ghost
Copy link
Author

ghost commented Mar 17, 2017

Note: I'll amend this to return a different error "Code" in the response, instead of hijacking the http status code.

done

@ghost
Copy link
Author

ghost commented Mar 22, 2017

Checking why CI is upset

@ghost
Copy link
Author

ghost commented Mar 22, 2017

Travis and Circle are happy now -- I didn't bother restarting the second Travis build though.

@ghost
Copy link
Author

ghost commented Mar 22, 2017

Wait this isn't quite right

@ghost
Copy link
Author

ghost commented Mar 22, 2017

Nevermind, I tested with the wrong binary. It does correctly return {"Message":"Could not resolve name.","Code":2} for ipfs dns foo.com.

Copy link
Member

@whyrusleeping whyrusleeping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, Thanks @lgierth :)

@whyrusleeping whyrusleeping merged commit 2cc5ce4 into master Mar 23, 2017
@whyrusleeping whyrusleeping deleted the fix/gateway-status-codes branch March 23, 2017 05:31
@whyrusleeping whyrusleeping removed the status/in-progress In progress label Mar 23, 2017
@ghost ghost restored the fix/gateway-status-codes branch May 18, 2017 02:57
@ghost ghost deleted the fix/gateway-status-codes branch June 8, 2017 02:25
hacdias pushed a commit to ipfs/boxo that referenced this pull request Jan 27, 2023
Return 404 Not Found for failed path resolutions

This commit was moved from ipfs/kubo@2cc5ce4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/api Topic api topic/gateway Topic gateway
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants