From 39bef0d5b01f70abf679fca2c4d078a2d55620e2 Mon Sep 17 00:00:00 2001 From: Lars Gierth Date: Thu, 7 Jul 2016 01:44:52 +0200 Subject: [PATCH] gateway: on api, restrict to webui License: MIT Signed-off-by: Lars Gierth --- cmd/ipfs/daemon.go | 2 +- test/sharness/t0110-gateway.sh | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/ipfs/daemon.go b/cmd/ipfs/daemon.go index c52f1756b..5eea1595b 100644 --- a/cmd/ipfs/daemon.go +++ b/cmd/ipfs/daemon.go @@ -367,7 +367,7 @@ func serveHTTPApi(req cmds.Request) (error, <-chan error) { corehttp.MetricsCollectionOption("api"), corehttp.CommandsOption(*req.InvocContext()), corehttp.WebUIOption, - corehttp.GatewayOption("/ipfs", "/ipns"), + corehttp.GatewayOption(corehttp.WebUIPaths...), corehttp.VersionOption(), defaultMux("/debug/vars"), defaultMux("/debug/pprof/"), diff --git a/test/sharness/t0110-gateway.sh b/test/sharness/t0110-gateway.sh index 7556ef4d4..fd218a344 100755 --- a/test/sharness/t0110-gateway.sh +++ b/test/sharness/t0110-gateway.sh @@ -32,6 +32,10 @@ test_expect_success "GET IPFS path output looks good" ' rm actual ' +test_expect_success "GET IPFS path on API unavailable" ' + test_curl_resp_http_code "http://127.0.0.1:$apiport/ipfs/$HASH" "HTTP/1.1 404 Not Found" +' + test_expect_success "GET IPFS directory path succeeds" ' mkdir dir && echo "12345" >dir/test &&