From 60092b876d6ce97779bf60c001547f33c6aa9865 Mon Sep 17 00:00:00 2001 From: Dr Ian Preston Date: Tue, 2 Oct 2018 00:42:05 +0100 Subject: [PATCH] change handler mount point to /proxy/http/ Licence: MIT Signed-off-by: Ian Preston ianopolous@protonmail.com --- core/corehttp/proxy.go | 6 +----- test/sharness/t0184-http-proxy-over-p2p.sh | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/core/corehttp/proxy.go b/core/corehttp/proxy.go index a3e2c735d06c..8e236d1558c6 100644 --- a/core/corehttp/proxy.go +++ b/core/corehttp/proxy.go @@ -15,7 +15,7 @@ import ( func ProxyOption() ServeOption { return func(ipfsNode *core.IpfsNode, _ net.Listener, mux *http.ServeMux) (*http.ServeMux, error) { - mux.HandleFunc("/proxy/", func(w http.ResponseWriter, request *http.Request) { + mux.HandleFunc("/proxy/http/", func(w http.ResponseWriter, request *http.Request) { // parse request parsedRequest, err := parseRequest(request) if err != nil { @@ -73,10 +73,6 @@ func parseRequest(request *http.Request) (*proxyRequest, error) { return nil, fmt.Errorf("Invalid request path '%s'", path) } - if split[2] != "http" { - return nil, fmt.Errorf("Invalid proxy request protocol '%s'", split[2]) - } - peerID, err := peer.IDB58Decode(split[3]) if err != nil { diff --git a/test/sharness/t0184-http-proxy-over-p2p.sh b/test/sharness/t0184-http-proxy-over-p2p.sh index cb1fecf7771e..46e456a37046 100755 --- a/test/sharness/t0184-http-proxy-over-p2p.sh +++ b/test/sharness/t0184-http-proxy-over-p2p.sh @@ -138,7 +138,7 @@ teardown_sender_and_receiver test_expect_success 'handle proxy http request invalid request' ' setup_receiver_ipfs && setup_sender_ipfs && -curl_check_response_code 400 DERPDERPDERP +curl_check_response_code 404 DERPDERPDERP ' teardown_sender_and_receiver