diff options
Diffstat (limited to 'swarm/api/http')
-rw-r--r-- | swarm/api/http/error.go | 54 | ||||
-rw-r--r-- | swarm/api/http/error_templates.go | 15 | ||||
-rw-r--r-- | swarm/api/http/error_test.go | 12 | ||||
-rw-r--r-- | swarm/api/http/roundtripper.go | 2 | ||||
-rw-r--r-- | swarm/api/http/server.go | 675 | ||||
-rw-r--r-- | swarm/api/http/server_test.go | 419 | ||||
-rw-r--r-- | swarm/api/http/templates.go | 3 |
7 files changed, 957 insertions, 223 deletions
diff --git a/swarm/api/http/error.go b/swarm/api/http/error.go index 9a65412cf..5fff7575e 100644 --- a/swarm/api/http/error.go +++ b/swarm/api/http/error.go @@ -31,6 +31,7 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/swarm/api" + l "github.com/ethereum/go-ethereum/swarm/log" ) //templateMap holds a mapping of an HTTP error code to a template @@ -44,7 +45,7 @@ var ( ) //parameters needed for formatting the correct HTML page -type ErrorParams struct { +type ResponseParams struct { Msg string Code int Timestamp string @@ -113,45 +114,49 @@ func ValidateCaseErrors(r *Request) string { //For example, if the user requests bzz:/<hash>/read and that manifest contains entries //"readme.md" and "readinglist.txt", a HTML page is returned with this two links. //This only applies if the manifest has no default entry -func ShowMultipleChoices(w http.ResponseWriter, r *Request, list api.ManifestList) { +func ShowMultipleChoices(w http.ResponseWriter, req *Request, list api.ManifestList) { msg := "" if list.Entries == nil { - ShowError(w, r, "Could not resolve", http.StatusInternalServerError) + Respond(w, req, "Could not resolve", http.StatusInternalServerError) return } //make links relative //requestURI comes with the prefix of the ambiguous path, e.g. "read" for "readme.md" and "readinglist.txt" //to get clickable links, need to remove the ambiguous path, i.e. "read" - idx := strings.LastIndex(r.RequestURI, "/") + idx := strings.LastIndex(req.RequestURI, "/") if idx == -1 { - ShowError(w, r, "Internal Server Error", http.StatusInternalServerError) + Respond(w, req, "Internal Server Error", http.StatusInternalServerError) return } //remove ambiguous part - base := r.RequestURI[:idx+1] + base := req.RequestURI[:idx+1] for _, e := range list.Entries { //create clickable link for each entry msg += "<a href='" + base + e.Path + "'>" + e.Path + "</a><br/>" } - respond(w, &r.Request, &ErrorParams{ - Code: http.StatusMultipleChoices, - Details: template.HTML(msg), - Timestamp: time.Now().Format(time.RFC1123), - template: getTemplate(http.StatusMultipleChoices), - }) + Respond(w, req, msg, http.StatusMultipleChoices) } -//ShowError is used to show an HTML error page to a client. +//Respond is used to show an HTML page to a client. //If there is an `Accept` header of `application/json`, JSON will be returned instead //The function just takes a string message which will be displayed in the error page. //The code is used to evaluate which template will be displayed //(and return the correct HTTP status code) -func ShowError(w http.ResponseWriter, r *Request, msg string, code int) { - additionalMessage := ValidateCaseErrors(r) - if code == http.StatusInternalServerError { - log.Error(msg) +func Respond(w http.ResponseWriter, req *Request, msg string, code int) { + additionalMessage := ValidateCaseErrors(req) + switch code { + case http.StatusInternalServerError: + log.Output(msg, log.LvlError, l.CallDepth, "ruid", req.ruid, "code", code) + default: + log.Output(msg, log.LvlDebug, l.CallDepth, "ruid", req.ruid, "code", code) + } + + if code >= 400 { + w.Header().Del("Cache-Control") //avoid sending cache headers for errors! + w.Header().Del("ETag") } - respond(w, &r.Request, &ErrorParams{ + + respond(w, &req.Request, &ResponseParams{ Code: code, Msg: msg, Details: template.HTML(additionalMessage), @@ -161,17 +166,17 @@ func ShowError(w http.ResponseWriter, r *Request, msg string, code int) { } //evaluate if client accepts html or json response -func respond(w http.ResponseWriter, r *http.Request, params *ErrorParams) { +func respond(w http.ResponseWriter, r *http.Request, params *ResponseParams) { w.WriteHeader(params.Code) if r.Header.Get("Accept") == "application/json" { - respondJson(w, params) + respondJSON(w, params) } else { - respondHtml(w, params) + respondHTML(w, params) } } //return a HTML page -func respondHtml(w http.ResponseWriter, params *ErrorParams) { +func respondHTML(w http.ResponseWriter, params *ResponseParams) { htmlCounter.Inc(1) err := params.template.Execute(w, params) if err != nil { @@ -180,7 +185,7 @@ func respondHtml(w http.ResponseWriter, params *ErrorParams) { } //return JSON -func respondJson(w http.ResponseWriter, params *ErrorParams) { +func respondJSON(w http.ResponseWriter, params *ResponseParams) { jsonCounter.Inc(1) w.Header().Set("Content-Type", "application/json") json.NewEncoder(w).Encode(params) @@ -190,7 +195,6 @@ func respondJson(w http.ResponseWriter, params *ErrorParams) { func getTemplate(code int) *template.Template { if val, tmpl := templateMap[code]; tmpl { return val - } else { - return templateMap[0] } + return templateMap[0] } diff --git a/swarm/api/http/error_templates.go b/swarm/api/http/error_templates.go index cc9b996ba..f3c643c90 100644 --- a/swarm/api/http/error_templates.go +++ b/swarm/api/http/error_templates.go @@ -36,7 +36,6 @@ func GetGenericErrorPage() string { <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> <meta http-equiv="X-UA-Compatible" ww="chrome=1"> <meta name="description" content="Ethereum/Swarm error page"> - <meta property="og:url" content="https://swarm-gateways.net/bzz:/theswarm.eth"> <link rel="shortcut icon" type="image/x-icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHsAAAB5CAYAAAAZD150AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g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fs6AXDcc57twIT+Me2XL2L/dlIdxV8mOruN0YhkF4w9yZ4oxqrJlhy/VXRstNg4GZs/hmNjukEh3ci2TmuJat2KO7sCm/kmx8MOinhkohIwGngSo3PfHMYVZOcxXtnGWGYgpyv4SZAdCjZg8dPtgIUvJ5yqdZJtS+drDsknUMA32LdhzJKI8ZVgJA6RvoBpY1xGthiZORD4yYIiE8M4SbIDaX5o7lws4GWcIGacunEDF3yJKflvqP4o+1rGLMtOYPw1ML4cEASeEkfvvl8Qo4Gfj6X7/DdJmQbZAZ9BmRNQxOsIwX4XBVzBhR+Ei6tkG4IyjNxb38fqxwqKzLpOHLTtRRrwqnWmYYpx71WOcaYJmld+roG5BuYamGtgroG5BuYamJoG/h/ff6XOIB4wOAAAAABJRU5ErkJggg=="/> <style> @@ -93,7 +92,7 @@ func GetGenericErrorPage() string { max-height: 60vh; padding: 50px 20px; opacity: 0.6; - background-color: #A9F5BF; + background-color: #FCEFD3; } table { @@ -193,7 +192,7 @@ func GetGenericErrorPage() string { <footer> <p> Swarm: Serverless Hosting Incentivised Peer-To-Peer Storage And Content Distribution<br/> - <a href="http://swarm-gateways.net/bzz:/theswarm.eth">Swarm</a> + <a href="/bzz:/theswarm.eth">Swarm</a> </p> </footer> @@ -216,7 +215,6 @@ func GetNotFoundErrorPage() string { <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> <meta http-equiv="X-UA-Compatible" ww="chrome=1"> <meta name="description" content="Ethereum/Swarm error page"> - <meta property="og:url" content="https://swarm-gateways.net/bzz:/theswarm.eth"> <link rel="shortcut icon" type="image/x-icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHsAAAB5CAYAAAAZD150AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3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d3SHtr/zvx77hy2FkHLKZVjH4Wmx9kAI3kcroVrrVXYwHtzHuz/4IGEcmm2ljvKWNcTNlO8ceWcYle3vBzeapGPfJzFgZjKQCkQNlWLLb9XWRQOufoffygSWUeUOzeQrlngLG3cjWuhTEOBTZASNz/hTjZWVBKI/srEZ74PY2MEA6ETW4wC7MXXvVdxiytWQV8CVIvpoMeQM1Fdm9jfG1xTEWJpspqG/VUozXgO6BMhGWTbZ1M8/dUMibaPgb2O/neoqQbX7+ZMNVjAr+in0HJkUsitsqE+u0axvj8ewPwDiQbPPjQz/Jl8F4Cfu+Ri0do4VUKUfT151Fte3P7fs6AXDcc57twIT+Me2XL2L/dlIdxV8mOruN0YhkF4w9yZ4oxqrJlhy/VXRstNg4GZs/hmNjukEh3ci2TmuJat2KO7sCm/kmx8MOinhkohIwGngSo3PfHMYVZOcxXtnGWGYgpyv4SZAdCjZg8dPtgIUvJ5yqdZJtS+drDsknUMA32LdhzJKI8ZVgJA6RvoBpY1xGthiZORD4yYIiE8M4SbIDaX5o7lws4GWcIGacunEDF3yJKflvqP4o+1rGLMtOYPw1ML4cEASeEkfvvl8Qo4Gfj6X7/DdJmQbZAZ9BmRNQxOsIwX4XBVzBhR+Ei6tkG4IyjNxb38fqxwqKzLpOHLTtRRrwqnWmYYpx71WOcaYJmld+roG5BuYamGtgroG5BuYamJoG/h/ff6XOIB4wOAAAAABJRU5ErkJggg=="/> <style> @@ -273,7 +271,7 @@ func GetNotFoundErrorPage() string { max-height: 60vh; padding: 50px 20px; opacity: 0.6; - background-color: #A9F5BF; + background-color: #FCEFD3; } table { @@ -373,7 +371,7 @@ func GetNotFoundErrorPage() string { <footer> <p> Swarm: Serverless Hosting Incentivised Peer-To-Peer Storage And Content Distribution<br/> - <a href="http://swarm-gateways.net/bzz:/theswarm.eth">Swarm</a> + <a href="/bzz:/theswarm.eth">Swarm</a> </p> </footer> @@ -398,7 +396,6 @@ func GetMultipleChoicesErrorPage() string { <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> <meta http-equiv="X-UA-Compatible" ww="chrome=1"> <meta name="description" content="Ethereum/Swarm multiple options page"> - <meta property="og:url" content="https://swarm-gateways.net/bzz:/theswarm.eth"> <link rel="shortcut icon" type="image/x-icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHsAAAB5CAYAAAAZD150AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAAFzFJREFUeAHtnXuwJFV9x7vnzrKwIC95w/ImYFkxlZgiGswCIiCGxPhHCEIwmIemUqYwJkYrJmXlUZRa+IpAWYYEk4qJD4gJGAmoiBIxMQFRQCkXdhdCeL+fYdk7nc+ne87dvnPn0TPTPdNzmd/W2X6fc76/7/n9zjm/PrcniuYy18BcA3MNzDUw18BcA3MNzDUw18BcA3MNrGYNLERroyMAeNQ0QcbTLPxFUfaOOx4Wbd12ThRHp0TJ4s5RFF8RtVoXg/2BSeOfk12lxtc0fjva1jibItZEDf4li3u3i3sqipOPRIvRp6ssvjPvhc4Tq/y4Ab71pEXS1oqw7hw1mz8XJc2LoiQ6iTJaaTkx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uYamJoG/h/ff6XOIB4wOAAAAABJRU5ErkJggg=="/> <style> @@ -455,7 +452,7 @@ func GetMultipleChoicesErrorPage() string { max-height: 60vh; padding: 50px 20px; opacity: 0.6; - background-color: #A9F5BF; + background-color: #FCEFD3; } table { @@ -550,7 +547,7 @@ func GetMultipleChoicesErrorPage() string { <footer> <p> Swarm: Serverless Hosting Incentivised Peer-To-Peer Storage And Content Distribution<br/> - <a href="http://swarm-gateways.net/bzz:/theswarm.eth">Swarm</a> + <a href="/bzz:/theswarm.eth">Swarm</a> </p> </footer> diff --git a/swarm/api/http/error_test.go b/swarm/api/http/error_test.go index dc545722e..86eff86b2 100644 --- a/swarm/api/http/error_test.go +++ b/swarm/api/http/error_test.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. -package http_test +package http import ( "encoding/json" @@ -30,7 +30,7 @@ import ( func TestError(t *testing.T) { - srv := testutil.NewTestSwarmServer(t) + srv := testutil.NewTestSwarmServer(t, serverFunc) defer srv.Close() var resp *http.Response @@ -56,7 +56,7 @@ func TestError(t *testing.T) { } func Test404Page(t *testing.T) { - srv := testutil.NewTestSwarmServer(t) + srv := testutil.NewTestSwarmServer(t, serverFunc) defer srv.Close() var resp *http.Response @@ -82,7 +82,7 @@ func Test404Page(t *testing.T) { } func Test500Page(t *testing.T) { - srv := testutil.NewTestSwarmServer(t) + srv := testutil.NewTestSwarmServer(t, serverFunc) defer srv.Close() var resp *http.Response @@ -107,7 +107,7 @@ func Test500Page(t *testing.T) { } } func Test500PageWith0xHashPrefix(t *testing.T) { - srv := testutil.NewTestSwarmServer(t) + srv := testutil.NewTestSwarmServer(t, serverFunc) defer srv.Close() var resp *http.Response @@ -137,7 +137,7 @@ func Test500PageWith0xHashPrefix(t *testing.T) { } func TestJsonResponse(t *testing.T) { - srv := testutil.NewTestSwarmServer(t) + srv := testutil.NewTestSwarmServer(t, serverFunc) defer srv.Close() var resp *http.Response diff --git a/swarm/api/http/roundtripper.go b/swarm/api/http/roundtripper.go index 019431771..be8ea3985 100644 --- a/swarm/api/http/roundtripper.go +++ b/swarm/api/http/roundtripper.go @@ -20,7 +20,7 @@ import ( "fmt" "net/http" - "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/swarm/log" ) /* diff --git a/swarm/api/http/server.go b/swarm/api/http/server.go index b8e7436cf..ba8b2b7ba 100644 --- a/swarm/api/http/server.go +++ b/swarm/api/http/server.go @@ -21,6 +21,8 @@ package http import ( "archive/tar" + "bufio" + "bytes" "encoding/json" "errors" "fmt" @@ -31,39 +33,44 @@ import ( "net/http" "os" "path" + "regexp" "strconv" "strings" "time" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/swarm/api" + "github.com/ethereum/go-ethereum/swarm/log" "github.com/ethereum/go-ethereum/swarm/storage" + "github.com/ethereum/go-ethereum/swarm/storage/mru" + "github.com/pborman/uuid" "github.com/rs/cors" ) -//setup metrics +type resourceResponse struct { + Manifest storage.Address `json:"manifest"` + Resource string `json:"resource"` + Update storage.Address `json:"update"` +} + var ( - postRawCount = metrics.NewRegisteredCounter("api.http.post.raw.count", nil) - postRawFail = metrics.NewRegisteredCounter("api.http.post.raw.fail", nil) - postFilesCount = metrics.NewRegisteredCounter("api.http.post.files.count", nil) - postFilesFail = metrics.NewRegisteredCounter("api.http.post.files.fail", nil) - deleteCount = metrics.NewRegisteredCounter("api.http.delete.count", nil) - deleteFail = metrics.NewRegisteredCounter("api.http.delete.fail", nil) - getCount = metrics.NewRegisteredCounter("api.http.get.count", nil) - getFail = metrics.NewRegisteredCounter("api.http.get.fail", nil) - getFileCount = metrics.NewRegisteredCounter("api.http.get.file.count", nil) - getFileNotFound = metrics.NewRegisteredCounter("api.http.get.file.notfound", nil) - getFileFail = metrics.NewRegisteredCounter("api.http.get.file.fail", nil) - getFilesCount = metrics.NewRegisteredCounter("api.http.get.files.count", nil) - getFilesFail = metrics.NewRegisteredCounter("api.http.get.files.fail", nil) - getListCount = metrics.NewRegisteredCounter("api.http.get.list.count", nil) - getListFail = metrics.NewRegisteredCounter("api.http.get.list.fail", nil) - requestCount = metrics.NewRegisteredCounter("http.request.count", nil) - htmlRequestCount = metrics.NewRegisteredCounter("http.request.html.count", nil) - jsonRequestCount = metrics.NewRegisteredCounter("http.request.json.count", nil) - requestTimer = metrics.NewRegisteredResettingTimer("http.request.time", nil) + postRawCount = metrics.NewRegisteredCounter("api.http.post.raw.count", nil) + postRawFail = metrics.NewRegisteredCounter("api.http.post.raw.fail", nil) + postFilesCount = metrics.NewRegisteredCounter("api.http.post.files.count", nil) + postFilesFail = metrics.NewRegisteredCounter("api.http.post.files.fail", nil) + deleteCount = metrics.NewRegisteredCounter("api.http.delete.count", nil) + deleteFail = metrics.NewRegisteredCounter("api.http.delete.fail", nil) + getCount = metrics.NewRegisteredCounter("api.http.get.count", nil) + getFail = metrics.NewRegisteredCounter("api.http.get.fail", nil) + getFileCount = metrics.NewRegisteredCounter("api.http.get.file.count", nil) + getFileNotFound = metrics.NewRegisteredCounter("api.http.get.file.notfound", nil) + getFileFail = metrics.NewRegisteredCounter("api.http.get.file.fail", nil) + getFilesCount = metrics.NewRegisteredCounter("api.http.get.files.count", nil) + getFilesFail = metrics.NewRegisteredCounter("api.http.get.files.fail", nil) + getListCount = metrics.NewRegisteredCounter("api.http.get.list.count", nil) + getListFail = metrics.NewRegisteredCounter("api.http.get.list.fail", nil) ) // ServerConfig is the basic configuration needed for the HTTP server and also @@ -79,7 +86,7 @@ type ServerConfig struct { // https://github.com/atom/electron/blob/master/docs/api/protocol.md // starts up http server -func StartHttpServer(api *api.Api, config *ServerConfig) { +func StartHTTPServer(api *api.API, config *ServerConfig) { var allowedOrigins []string for _, domain := range strings.Split(config.CorsString, ",") { allowedOrigins = append(allowedOrigins, strings.TrimSpace(domain)) @@ -95,82 +102,106 @@ func StartHttpServer(api *api.Api, config *ServerConfig) { go http.ListenAndServe(config.Addr, hdlr) } -func NewServer(api *api.Api) *Server { +func NewServer(api *api.API) *Server { return &Server{api} } type Server struct { - api *api.Api + api *api.API } // Request wraps http.Request and also includes the parsed bzz URI type Request struct { http.Request - uri *api.URI + uri *api.URI + ruid string // request unique id } // HandlePostRaw handles a POST request to a raw bzz-raw:/ URI, stores the request -// body in swarm and returns the resulting storage key as a text/plain response +// body in swarm and returns the resulting storage address as a text/plain response func (s *Server) HandlePostRaw(w http.ResponseWriter, r *Request) { + log.Debug("handle.post.raw", "ruid", r.ruid) + postRawCount.Inc(1) + + toEncrypt := false + if r.uri.Addr == "encrypt" { + toEncrypt = true + } + if r.uri.Path != "" { postRawFail.Inc(1) - s.BadRequest(w, r, "raw POST request cannot contain a path") + Respond(w, r, "raw POST request cannot contain a path", http.StatusBadRequest) return } - if r.Header.Get("Content-Length") == "" { + if r.uri.Addr != "" && r.uri.Addr != "encrypt" { postRawFail.Inc(1) - s.BadRequest(w, r, "missing Content-Length header in request") + Respond(w, r, "raw POST request addr can only be empty or \"encrypt\"", http.StatusBadRequest) return } - key, err := s.api.Store(r.Body, r.ContentLength, nil) + if r.Header.Get("Content-Length") == "" { + postRawFail.Inc(1) + Respond(w, r, "missing Content-Length header in request", http.StatusBadRequest) + return + } + addr, _, err := s.api.Store(r.Body, r.ContentLength, toEncrypt) if err != nil { postRawFail.Inc(1) - s.Error(w, r, err) + Respond(w, r, err.Error(), http.StatusInternalServerError) return } - s.logDebug("content for %s stored", key.Log()) + + log.Debug("stored content", "ruid", r.ruid, "key", addr) w.Header().Set("Content-Type", "text/plain") w.WriteHeader(http.StatusOK) - fmt.Fprint(w, key) + fmt.Fprint(w, addr) } -// HandlePostFiles handles a POST request (or deprecated PUT request) to +// HandlePostFiles handles a POST request to // bzz:/<hash>/<path> which contains either a single file or multiple files // (either a tar archive or multipart form), adds those files either to an // existing manifest or to a new manifest under <path> and returns the // resulting manifest hash as a text/plain response func (s *Server) HandlePostFiles(w http.ResponseWriter, r *Request) { + log.Debug("handle.post.files", "ruid", r.ruid) + postFilesCount.Inc(1) contentType, params, err := mime.ParseMediaType(r.Header.Get("Content-Type")) if err != nil { postFilesFail.Inc(1) - s.BadRequest(w, r, err.Error()) + Respond(w, r, err.Error(), http.StatusBadRequest) return } - var key storage.Key - if r.uri.Addr != "" { - key, err = s.api.Resolve(r.uri) + toEncrypt := false + if r.uri.Addr == "encrypt" { + toEncrypt = true + } + + var addr storage.Address + if r.uri.Addr != "" && r.uri.Addr != "encrypt" { + addr, err = s.api.Resolve(r.uri) if err != nil { postFilesFail.Inc(1) - s.Error(w, r, fmt.Errorf("error resolving %s: %s", r.uri.Addr, err)) + Respond(w, r, fmt.Sprintf("cannot resolve %s: %s", r.uri.Addr, err), http.StatusInternalServerError) return } + log.Debug("resolved key", "ruid", r.ruid, "key", addr) } else { - key, err = s.api.NewManifest() + addr, err = s.api.NewManifest(toEncrypt) if err != nil { postFilesFail.Inc(1) - s.Error(w, r, err) + Respond(w, r, err.Error(), http.StatusInternalServerError) return } + log.Debug("new manifest", "ruid", r.ruid, "key", addr) } - newKey, err := s.updateManifest(key, func(mw *api.ManifestWriter) error { + newAddr, err := s.updateManifest(addr, func(mw *api.ManifestWriter) error { switch contentType { case "application/x-tar": @@ -185,16 +216,19 @@ func (s *Server) HandlePostFiles(w http.ResponseWriter, r *Request) { }) if err != nil { postFilesFail.Inc(1) - s.Error(w, r, fmt.Errorf("error creating manifest: %s", err)) + Respond(w, r, fmt.Sprintf("cannot create manifest: %s", err), http.StatusInternalServerError) return } + log.Debug("stored content", "ruid", r.ruid, "key", newAddr) + w.Header().Set("Content-Type", "text/plain") w.WriteHeader(http.StatusOK) - fmt.Fprint(w, newKey) + fmt.Fprint(w, newAddr) } func (s *Server) handleTarUpload(req *Request, mw *api.ManifestWriter) error { + log.Debug("handle.tar.upload", "ruid", req.ruid) tr := tar.NewReader(req.Body) for { hdr, err := tr.Next() @@ -218,16 +252,17 @@ func (s *Server) handleTarUpload(req *Request, mw *api.ManifestWriter) error { Size: hdr.Size, ModTime: hdr.ModTime, } - s.logDebug("adding %s (%d bytes) to new manifest", entry.Path, entry.Size) + log.Debug("adding path to new manifest", "ruid", req.ruid, "bytes", entry.Size, "path", entry.Path) contentKey, err := mw.AddEntry(tr, entry) if err != nil { return fmt.Errorf("error adding manifest entry from tar stream: %s", err) } - s.logDebug("content for %s stored", contentKey.Log()) + log.Debug("stored content", "ruid", req.ruid, "key", contentKey) } } func (s *Server) handleMultipartUpload(req *Request, boundary string, mw *api.ManifestWriter) error { + log.Debug("handle.multipart.upload", "ruid", req.ruid) mr := multipart.NewReader(req.Body, boundary) for { part, err := mr.NextPart() @@ -275,16 +310,17 @@ func (s *Server) handleMultipartUpload(req *Request, boundary string, mw *api.Ma Size: size, ModTime: time.Now(), } - s.logDebug("adding %s (%d bytes) to new manifest", entry.Path, entry.Size) + log.Debug("adding path to new manifest", "ruid", req.ruid, "bytes", entry.Size, "path", entry.Path) contentKey, err := mw.AddEntry(reader, entry) if err != nil { return fmt.Errorf("error adding manifest entry from multipart form: %s", err) } - s.logDebug("content for %s stored", contentKey.Log()) + log.Debug("stored content", "ruid", req.ruid, "key", contentKey) } } func (s *Server) handleDirectUpload(req *Request, mw *api.ManifestWriter) error { + log.Debug("handle.direct.upload", "ruid", req.ruid) key, err := mw.AddEntry(req.Body, &api.ManifestEntry{ Path: req.uri.Path, ContentType: req.Header.Get("Content-Type"), @@ -295,7 +331,7 @@ func (s *Server) handleDirectUpload(req *Request, mw *api.ManifestWriter) error if err != nil { return err } - s.logDebug("content for %s stored", key.Log()) + log.Debug("stored content", "ruid", req.ruid, "key", key) return nil } @@ -303,21 +339,23 @@ func (s *Server) handleDirectUpload(req *Request, mw *api.ManifestWriter) error // <path> from <manifest> and returns the resulting manifest hash as a // text/plain response func (s *Server) HandleDelete(w http.ResponseWriter, r *Request) { + log.Debug("handle.delete", "ruid", r.ruid) + deleteCount.Inc(1) key, err := s.api.Resolve(r.uri) if err != nil { deleteFail.Inc(1) - s.Error(w, r, fmt.Errorf("error resolving %s: %s", r.uri.Addr, err)) + Respond(w, r, fmt.Sprintf("cannot resolve %s: %s", r.uri.Addr, err), http.StatusInternalServerError) return } newKey, err := s.updateManifest(key, func(mw *api.ManifestWriter) error { - s.logDebug("removing %s from manifest %s", r.uri.Path, key.Log()) + log.Debug(fmt.Sprintf("removing %s from manifest %s", r.uri.Path, key.Log()), "ruid", r.ruid) return mw.RemoveEntry(r.uri.Path) }) if err != nil { deleteFail.Inc(1) - s.Error(w, r, fmt.Errorf("error updating manifest: %s", err)) + Respond(w, r, fmt.Sprintf("cannot update manifest: %s", err), http.StatusInternalServerError) return } @@ -326,27 +364,290 @@ func (s *Server) HandleDelete(w http.ResponseWriter, r *Request) { fmt.Fprint(w, newKey) } +// Parses a resource update post url to corresponding action +// possible combinations: +// / add multihash update to existing hash +// /raw add raw update to existing hash +// /# create new resource with first update as mulitihash +// /raw/# create new resource with first update raw +func resourcePostMode(path string) (isRaw bool, frequency uint64, err error) { + re, err := regexp.Compile("^(raw)?/?([0-9]+)?$") + if err != nil { + return isRaw, frequency, err + } + m := re.FindAllStringSubmatch(path, 2) + var freqstr = "0" + if len(m) > 0 { + if m[0][1] != "" { + isRaw = true + } + if m[0][2] != "" { + freqstr = m[0][2] + } + } else if len(path) > 0 { + return isRaw, frequency, fmt.Errorf("invalid path") + } + frequency, err = strconv.ParseUint(freqstr, 10, 64) + return isRaw, frequency, err +} + +// Handles creation of new mutable resources and adding updates to existing mutable resources +// There are two types of updates available, "raw" and "multihash." +// If the latter is used, a subsequent bzz:// GET call to the manifest of the resource will return +// the page that the multihash is pointing to, as if it held a normal swarm content manifest +// +// The resource name will be verbatim what is passed as the address part of the url. +// For example, if a POST is made to /bzz-resource:/foo.eth/raw/13 a new resource with frequency 13 +// and name "foo.eth" will be created +func (s *Server) HandlePostResource(w http.ResponseWriter, r *Request) { + log.Debug("handle.post.resource", "ruid", r.ruid) + var err error + var addr storage.Address + var name string + var outdata []byte + isRaw, frequency, err := resourcePostMode(r.uri.Path) + if err != nil { + Respond(w, r, err.Error(), http.StatusBadRequest) + return + } + + // new mutable resource creation will always have a frequency field larger than 0 + if frequency > 0 { + + name = r.uri.Addr + + // the key is the content addressed root chunk holding mutable resource metadata information + addr, err = s.api.ResourceCreate(r.Context(), name, frequency) + if err != nil { + code, err2 := s.translateResourceError(w, r, "resource creation fail", err) + + Respond(w, r, err2.Error(), code) + return + } + + // we create a manifest so we can retrieve the resource with bzz:// later + // this manifest has a special "resource type" manifest, and its hash is the key of the mutable resource + // root chunk + m, err := s.api.NewResourceManifest(addr.Hex()) + if err != nil { + Respond(w, r, fmt.Sprintf("failed to create resource manifest: %v", err), http.StatusInternalServerError) + return + } + + // the key to the manifest will be passed back to the client + // the client can access the root chunk key directly through its Hash member + // the manifest key should be set as content in the resolver of the ENS name + // \TODO update manifest key automatically in ENS + outdata, err = json.Marshal(m) + if err != nil { + Respond(w, r, fmt.Sprintf("failed to create json response: %s", err), http.StatusInternalServerError) + return + } + } else { + // to update the resource through http we need to retrieve the key for the mutable resource root chunk + // that means that we retrieve the manifest and inspect its Hash member. + manifestAddr := r.uri.Address() + if manifestAddr == nil { + manifestAddr, err = s.api.Resolve(r.uri) + if err != nil { + getFail.Inc(1) + Respond(w, r, fmt.Sprintf("cannot resolve %s: %s", r.uri.Addr, err), http.StatusNotFound) + return + } + } else { + w.Header().Set("Cache-Control", "max-age=2147483648") + } + + // get the root chunk key from the manifest + addr, err = s.api.ResolveResourceManifest(manifestAddr) + if err != nil { + getFail.Inc(1) + Respond(w, r, fmt.Sprintf("error resolving resource root chunk for %s: %s", r.uri.Addr, err), http.StatusNotFound) + return + } + + log.Debug("handle.post.resource: resolved", "ruid", r.ruid, "manifestkey", manifestAddr, "rootchunkkey", addr) + + name, _, err = s.api.ResourceLookup(r.Context(), addr, 0, 0, &mru.LookupParams{}) + if err != nil { + Respond(w, r, err.Error(), http.StatusNotFound) + return + } + } + + // Creation and update must send data aswell. This data constitutes the update data itself. + data, err := ioutil.ReadAll(r.Body) + if err != nil { + Respond(w, r, err.Error(), http.StatusInternalServerError) + return + } + + // Multihash will be passed as hex-encoded data, so we need to parse this to bytes + if isRaw { + _, _, _, err = s.api.ResourceUpdate(r.Context(), name, data) + if err != nil { + Respond(w, r, err.Error(), http.StatusBadRequest) + return + } + } else { + bytesdata, err := hexutil.Decode(string(data)) + if err != nil { + Respond(w, r, err.Error(), http.StatusBadRequest) + return + } + _, _, _, err = s.api.ResourceUpdateMultihash(r.Context(), name, bytesdata) + if err != nil { + Respond(w, r, err.Error(), http.StatusBadRequest) + return + } + } + + // If we have data to return, write this now + // \TODO there should always be data to return here + if len(outdata) > 0 { + w.Header().Add("Content-type", "text/plain") + w.WriteHeader(http.StatusOK) + fmt.Fprint(w, string(outdata)) + return + } + w.WriteHeader(http.StatusOK) +} + +// Retrieve mutable resource updates: +// bzz-resource://<id> - get latest update +// bzz-resource://<id>/<n> - get latest update on period n +// bzz-resource://<id>/<n>/<m> - get update version m of period n +// <id> = ens name or hash +func (s *Server) HandleGetResource(w http.ResponseWriter, r *Request) { + s.handleGetResource(w, r) +} + +// TODO: Enable pass maxPeriod parameter +func (s *Server) handleGetResource(w http.ResponseWriter, r *Request) { + log.Debug("handle.get.resource", "ruid", r.ruid) + var err error + + // resolve the content key. + manifestAddr := r.uri.Address() + if manifestAddr == nil { + manifestAddr, err = s.api.Resolve(r.uri) + if err != nil { + getFail.Inc(1) + Respond(w, r, fmt.Sprintf("cannot resolve %s: %s", r.uri.Addr, err), http.StatusNotFound) + return + } + } else { + w.Header().Set("Cache-Control", "max-age=2147483648") + } + + // get the root chunk key from the manifest + key, err := s.api.ResolveResourceManifest(manifestAddr) + if err != nil { + getFail.Inc(1) + Respond(w, r, fmt.Sprintf("error resolving resource root chunk for %s: %s", r.uri.Addr, err), http.StatusNotFound) + return + } + + log.Debug("handle.get.resource: resolved", "ruid", r.ruid, "manifestkey", manifestAddr, "rootchunk key", key) + + // determine if the query specifies period and version + var params []string + if len(r.uri.Path) > 0 { + params = strings.Split(r.uri.Path, "/") + } + var name string + var period uint64 + var version uint64 + var data []byte + now := time.Now() + + switch len(params) { + case 0: // latest only + name, data, err = s.api.ResourceLookup(r.Context(), key, 0, 0, nil) + case 2: // specific period and version + version, err = strconv.ParseUint(params[1], 10, 32) + if err != nil { + break + } + period, err = strconv.ParseUint(params[0], 10, 32) + if err != nil { + break + } + name, data, err = s.api.ResourceLookup(r.Context(), key, uint32(period), uint32(version), nil) + case 1: // last version of specific period + period, err = strconv.ParseUint(params[0], 10, 32) + if err != nil { + break + } + name, data, err = s.api.ResourceLookup(r.Context(), key, uint32(period), uint32(version), nil) + default: // bogus + err = mru.NewError(storage.ErrInvalidValue, "invalid mutable resource request") + } + + // any error from the switch statement will end up here + if err != nil { + code, err2 := s.translateResourceError(w, r, "mutable resource lookup fail", err) + Respond(w, r, err2.Error(), code) + return + } + + // All ok, serve the retrieved update + log.Debug("Found update", "name", name, "ruid", r.ruid) + w.Header().Set("Content-Type", "application/octet-stream") + http.ServeContent(w, &r.Request, "", now, bytes.NewReader(data)) +} + +func (s *Server) translateResourceError(w http.ResponseWriter, r *Request, supErr string, err error) (int, error) { + code := 0 + defaultErr := fmt.Errorf("%s: %v", supErr, err) + rsrcErr, ok := err.(*mru.Error) + if !ok && rsrcErr != nil { + code = rsrcErr.Code() + } + switch code { + case storage.ErrInvalidValue: + return http.StatusBadRequest, defaultErr + case storage.ErrNotFound, storage.ErrNotSynced, storage.ErrNothingToReturn, storage.ErrInit: + return http.StatusNotFound, defaultErr + case storage.ErrUnauthorized, storage.ErrInvalidSignature: + return http.StatusUnauthorized, defaultErr + case storage.ErrDataOverflow: + return http.StatusRequestEntityTooLarge, defaultErr + } + + return http.StatusInternalServerError, defaultErr +} + // HandleGet handles a GET request to // - bzz-raw://<key> and responds with the raw content stored at the // given storage key // - bzz-hash://<key> and responds with the hash of the content stored // at the given storage key as a text/plain response func (s *Server) HandleGet(w http.ResponseWriter, r *Request) { + log.Debug("handle.get", "ruid", r.ruid, "uri", r.uri) getCount.Inc(1) - key, err := s.api.Resolve(r.uri) - if err != nil { - getFail.Inc(1) - s.NotFound(w, r, fmt.Errorf("error resolving %s: %s", r.uri.Addr, err)) - return + var err error + addr := r.uri.Address() + if addr == nil { + addr, err = s.api.Resolve(r.uri) + if err != nil { + getFail.Inc(1) + Respond(w, r, fmt.Sprintf("cannot resolve %s: %s", r.uri.Addr, err), http.StatusNotFound) + return + } + } else { + w.Header().Set("Cache-Control", "max-age=2147483648, immutable") // url was of type bzz://<hex key>/path, so we are sure it is immutable. } + log.Debug("handle.get: resolved", "ruid", r.ruid, "key", addr) + // if path is set, interpret <key> as a manifest and return the // raw entry at the given path if r.uri.Path != "" { - walker, err := s.api.NewManifestWalker(key, nil) + walker, err := s.api.NewManifestWalker(addr, nil) if err != nil { getFail.Inc(1) - s.BadRequest(w, r, fmt.Sprintf("%s is not a manifest", key)) + Respond(w, r, fmt.Sprintf("%s is not a manifest", addr), http.StatusBadRequest) return } var entry *api.ManifestEntry @@ -371,26 +672,37 @@ func (s *Server) HandleGet(w http.ResponseWriter, r *Request) { return nil } - return api.SkipManifest + return api.ErrSkipManifest }) if entry == nil { getFail.Inc(1) - s.NotFound(w, r, fmt.Errorf("Manifest entry could not be loaded")) + Respond(w, r, fmt.Sprintf("manifest entry could not be loaded"), http.StatusNotFound) + return + } + addr = storage.Address(common.Hex2Bytes(entry.Hash)) + } + etag := common.Bytes2Hex(addr) + noneMatchEtag := r.Header.Get("If-None-Match") + w.Header().Set("ETag", fmt.Sprintf("%q", etag)) // set etag to manifest key or raw entry key. + if noneMatchEtag != "" { + if bytes.Equal(storage.Address(common.Hex2Bytes(noneMatchEtag)), addr) { + Respond(w, r, "Not Modified", http.StatusNotModified) return } - key = storage.Key(common.Hex2Bytes(entry.Hash)) } // check the root chunk exists by retrieving the file's size - reader := s.api.Retrieve(key) + reader, isEncrypted := s.api.Retrieve(addr) if _, err := reader.Size(nil); err != nil { getFail.Inc(1) - s.NotFound(w, r, fmt.Errorf("Root chunk not found %s: %s", key, err)) + Respond(w, r, fmt.Sprintf("root chunk not found %s: %s", addr, err), http.StatusNotFound) return } + w.Header().Set("X-Decrypted", fmt.Sprintf("%v", isEncrypted)) + switch { - case r.uri.Raw() || r.uri.DeprecatedRaw(): + case r.uri.Raw(): // allow the request to overwrite the content type using a query // parameter contentType := "application/octet-stream" @@ -398,12 +710,11 @@ func (s *Server) HandleGet(w http.ResponseWriter, r *Request) { contentType = typ } w.Header().Set("Content-Type", contentType) - http.ServeContent(w, &r.Request, "", time.Now(), reader) case r.uri.Hash(): w.Header().Set("Content-Type", "text/plain") w.WriteHeader(http.StatusOK) - fmt.Fprint(w, key) + fmt.Fprint(w, addr) } } @@ -411,24 +722,26 @@ func (s *Server) HandleGet(w http.ResponseWriter, r *Request) { // header of "application/x-tar" and returns a tar stream of all files // contained in the manifest func (s *Server) HandleGetFiles(w http.ResponseWriter, r *Request) { + log.Debug("handle.get.files", "ruid", r.ruid, "uri", r.uri) getFilesCount.Inc(1) if r.uri.Path != "" { getFilesFail.Inc(1) - s.BadRequest(w, r, "files request cannot contain a path") + Respond(w, r, "files request cannot contain a path", http.StatusBadRequest) return } - key, err := s.api.Resolve(r.uri) + addr, err := s.api.Resolve(r.uri) if err != nil { getFilesFail.Inc(1) - s.NotFound(w, r, fmt.Errorf("error resolving %s: %s", r.uri.Addr, err)) + Respond(w, r, fmt.Sprintf("cannot resolve %s: %s", r.uri.Addr, err), http.StatusNotFound) return } + log.Debug("handle.get.files: resolved", "ruid", r.ruid, "key", addr) - walker, err := s.api.NewManifestWalker(key, nil) + walker, err := s.api.NewManifestWalker(addr, nil) if err != nil { getFilesFail.Inc(1) - s.Error(w, r, err) + Respond(w, r, err.Error(), http.StatusInternalServerError) return } @@ -444,11 +757,12 @@ func (s *Server) HandleGetFiles(w http.ResponseWriter, r *Request) { } // retrieve the entry's key and size - reader := s.api.Retrieve(storage.Key(common.Hex2Bytes(entry.Hash))) + reader, isEncrypted := s.api.Retrieve(storage.Address(common.Hex2Bytes(entry.Hash))) size, err := reader.Size(nil) if err != nil { return err } + w.Header().Set("X-Decrypted", fmt.Sprintf("%v", isEncrypted)) // write a tar header for the entry hdr := &tar.Header{ @@ -476,7 +790,7 @@ func (s *Server) HandleGetFiles(w http.ResponseWriter, r *Request) { }) if err != nil { getFilesFail.Inc(1) - s.logError("error generating tar stream: %s", err) + log.Error(fmt.Sprintf("error generating tar stream: %s", err)) } } @@ -484,6 +798,7 @@ func (s *Server) HandleGetFiles(w http.ResponseWriter, r *Request) { // a list of all files contained in <manifest> under <path> grouped into // common prefixes using "/" as a delimiter func (s *Server) HandleGetList(w http.ResponseWriter, r *Request) { + log.Debug("handle.get.list", "ruid", r.ruid, "uri", r.uri) getListCount.Inc(1) // ensure the root path has a trailing slash so that relative URLs work if r.uri.Path == "" && !strings.HasSuffix(r.URL.Path, "/") { @@ -491,18 +806,19 @@ func (s *Server) HandleGetList(w http.ResponseWriter, r *Request) { return } - key, err := s.api.Resolve(r.uri) + addr, err := s.api.Resolve(r.uri) if err != nil { getListFail.Inc(1) - s.NotFound(w, r, fmt.Errorf("error resolving %s: %s", r.uri.Addr, err)) + Respond(w, r, fmt.Sprintf("cannot resolve %s: %s", r.uri.Addr, err), http.StatusNotFound) return } + log.Debug("handle.get.list: resolved", "ruid", r.ruid, "key", addr) - list, err := s.getManifestList(key, r.uri.Path) + list, err := s.getManifestList(addr, r.uri.Path) if err != nil { getListFail.Inc(1) - s.Error(w, r, err) + Respond(w, r, err.Error(), http.StatusInternalServerError) return } @@ -520,7 +836,7 @@ func (s *Server) HandleGetList(w http.ResponseWriter, r *Request) { }) if err != nil { getListFail.Inc(1) - s.logError("error rendering list HTML: %s", err) + log.Error(fmt.Sprintf("error rendering list HTML: %s", err)) } return } @@ -529,8 +845,8 @@ func (s *Server) HandleGetList(w http.ResponseWriter, r *Request) { json.NewEncoder(w).Encode(&list) } -func (s *Server) getManifestList(key storage.Key, prefix string) (list api.ManifestList, err error) { - walker, err := s.api.NewManifestWalker(key, nil) +func (s *Server) getManifestList(addr storage.Address, prefix string) (list api.ManifestList, err error) { + walker, err := s.api.NewManifestWalker(addr, nil) if err != nil { return } @@ -572,14 +888,14 @@ func (s *Server) getManifestList(key storage.Key, prefix string) (list api.Manif suffix := strings.TrimPrefix(entry.Path, prefix) if index := strings.Index(suffix, "/"); index > -1 { list.CommonPrefixes = append(list.CommonPrefixes, prefix+suffix[:index+1]) - return api.SkipManifest + return api.ErrSkipManifest } return nil } // the manifest neither has the prefix or needs recursing in to // so just skip it - return api.SkipManifest + return api.ErrSkipManifest }) return list, nil @@ -588,29 +904,49 @@ func (s *Server) getManifestList(key storage.Key, prefix string) (list api.Manif // HandleGetFile handles a GET request to bzz://<manifest>/<path> and responds // with the content of the file at <path> from the given <manifest> func (s *Server) HandleGetFile(w http.ResponseWriter, r *Request) { + log.Debug("handle.get.file", "ruid", r.ruid) getFileCount.Inc(1) // ensure the root path has a trailing slash so that relative URLs work if r.uri.Path == "" && !strings.HasSuffix(r.URL.Path, "/") { http.Redirect(w, &r.Request, r.URL.Path+"/", http.StatusMovedPermanently) return } + var err error + manifestAddr := r.uri.Address() - key, err := s.api.Resolve(r.uri) - if err != nil { - getFileFail.Inc(1) - s.NotFound(w, r, fmt.Errorf("error resolving %s: %s", r.uri.Addr, err)) - return + if manifestAddr == nil { + manifestAddr, err = s.api.Resolve(r.uri) + if err != nil { + getFileFail.Inc(1) + Respond(w, r, fmt.Sprintf("cannot resolve %s: %s", r.uri.Addr, err), http.StatusNotFound) + return + } + } else { + w.Header().Set("Cache-Control", "max-age=2147483648, immutable") // url was of type bzz://<hex key>/path, so we are sure it is immutable. + } + + log.Debug("handle.get.file: resolved", "ruid", r.ruid, "key", manifestAddr) + + reader, contentType, status, contentKey, err := s.api.Get(manifestAddr, r.uri.Path) + + etag := common.Bytes2Hex(contentKey) + noneMatchEtag := r.Header.Get("If-None-Match") + w.Header().Set("ETag", fmt.Sprintf("%q", etag)) // set etag to actual content key. + if noneMatchEtag != "" { + if bytes.Equal(storage.Address(common.Hex2Bytes(noneMatchEtag)), contentKey) { + Respond(w, r, "Not Modified", http.StatusNotModified) + return + } } - reader, contentType, status, err := s.api.Get(key, r.uri.Path) if err != nil { switch status { case http.StatusNotFound: getFileNotFound.Inc(1) - s.NotFound(w, r, err) + Respond(w, r, err.Error(), http.StatusNotFound) default: getFileFail.Inc(1) - s.Error(w, r, err) + Respond(w, r, err.Error(), http.StatusInternalServerError) } return } @@ -618,15 +954,15 @@ func (s *Server) HandleGetFile(w http.ResponseWriter, r *Request) { //the request results in ambiguous files //e.g. /read with readme.md and readinglist.txt available in manifest if status == http.StatusMultipleChoices { - list, err := s.getManifestList(key, r.uri.Path) + list, err := s.getManifestList(manifestAddr, r.uri.Path) if err != nil { getFileFail.Inc(1) - s.Error(w, r, err) + Respond(w, r, err.Error(), http.StatusInternalServerError) return } - s.logDebug(fmt.Sprintf("Multiple choices! --> %v", list)) + log.Debug(fmt.Sprintf("Multiple choices! --> %v", list), "ruid", r.ruid) //show a nice page links to available entries ShowMultipleChoices(w, r, list) return @@ -635,79 +971,121 @@ func (s *Server) HandleGetFile(w http.ResponseWriter, r *Request) { // check the root chunk exists by retrieving the file's size if _, err := reader.Size(nil); err != nil { getFileNotFound.Inc(1) - s.NotFound(w, r, fmt.Errorf("File not found %s: %s", r.uri, err)) + Respond(w, r, fmt.Sprintf("file not found %s: %s", r.uri, err), http.StatusNotFound) return } w.Header().Set("Content-Type", contentType) + http.ServeContent(w, &r.Request, "", time.Now(), newBufferedReadSeeker(reader, getFileBufferSize)) +} - http.ServeContent(w, &r.Request, "", time.Now(), reader) +// The size of buffer used for bufio.Reader on LazyChunkReader passed to +// http.ServeContent in HandleGetFile. +// Warning: This value influences the number of chunk requests and chunker join goroutines +// per file request. +// Recommended value is 4 times the io.Copy default buffer value which is 32kB. +const getFileBufferSize = 4 * 32 * 1024 + +// bufferedReadSeeker wraps bufio.Reader to expose Seek method +// from the provied io.ReadSeeker in newBufferedReadSeeker. +type bufferedReadSeeker struct { + r io.Reader + s io.Seeker } -func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { - if metrics.Enabled { - //The increment for request count and request timer themselves have a flag check - //for metrics.Enabled. Nevertheless, we introduce the if here because we - //are looking into the header just to see what request type it is (json/html). - //So let's take advantage and add all metrics related stuff here - requestCount.Inc(1) - defer requestTimer.UpdateSince(time.Now()) - if r.Header.Get("Accept") == "application/json" { - jsonRequestCount.Inc(1) - } else { - htmlRequestCount.Inc(1) - } +// newBufferedReadSeeker creates a new instance of bufferedReadSeeker, +// out of io.ReadSeeker. Argument `size` is the size of the read buffer. +func newBufferedReadSeeker(readSeeker io.ReadSeeker, size int) bufferedReadSeeker { + return bufferedReadSeeker{ + r: bufio.NewReaderSize(readSeeker, size), + s: readSeeker, } - s.logDebug("HTTP %s request URL: '%s', Host: '%s', Path: '%s', Referer: '%s', Accept: '%s'", r.Method, r.RequestURI, r.URL.Host, r.URL.Path, r.Referer(), r.Header.Get("Accept")) +} + +func (b bufferedReadSeeker) Read(p []byte) (n int, err error) { + return b.r.Read(p) +} + +func (b bufferedReadSeeker) Seek(offset int64, whence int) (int64, error) { + return b.s.Seek(offset, whence) +} + +func (s *Server) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + defer metrics.GetOrRegisterResettingTimer(fmt.Sprintf("http.request.%s.time", r.Method), nil).UpdateSince(time.Now()) + req := &Request{Request: *r, ruid: uuid.New()[:8]} + metrics.GetOrRegisterCounter(fmt.Sprintf("http.request.%s", r.Method), nil).Inc(1) + log.Info("serving request", "ruid", req.ruid, "method", r.Method, "url", r.RequestURI) + + // wrapping the ResponseWriter, so that we get the response code set by http.ServeContent + w := newLoggingResponseWriter(rw) if r.RequestURI == "/" && strings.Contains(r.Header.Get("Accept"), "text/html") { err := landingPageTemplate.Execute(w, nil) if err != nil { - s.logError("error rendering landing page: %s", err) + log.Error(fmt.Sprintf("error rendering landing page: %s", err)) } return } + if r.URL.Path == "/robots.txt" { + w.Header().Set("Last-Modified", time.Now().Format(http.TimeFormat)) + fmt.Fprintf(w, "User-agent: *\nDisallow: /") + return + } + + if r.RequestURI == "/" && strings.Contains(r.Header.Get("Accept"), "application/json") { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + json.NewEncoder(w).Encode("Welcome to Swarm!") + return + } + uri, err := api.Parse(strings.TrimLeft(r.URL.Path, "/")) - req := &Request{Request: *r, uri: uri} if err != nil { - s.logError("Invalid URI %q: %s", r.URL.Path, err) - s.BadRequest(w, req, fmt.Sprintf("Invalid URI %q: %s", r.URL.Path, err)) + Respond(w, req, fmt.Sprintf("invalid URI %q", r.URL.Path), http.StatusBadRequest) return } - s.logDebug("%s request received for %s", r.Method, uri) + + req.uri = uri + + log.Debug("parsed request path", "ruid", req.ruid, "method", req.Method, "uri.Addr", req.uri.Addr, "uri.Path", req.uri.Path, "uri.Scheme", req.uri.Scheme) switch r.Method { case "POST": - if uri.Raw() || uri.DeprecatedRaw() { + if uri.Raw() { + log.Debug("handlePostRaw") s.HandlePostRaw(w, req) + } else if uri.Resource() { + log.Debug("handlePostResource") + s.HandlePostResource(w, req) + } else if uri.Immutable() || uri.List() || uri.Hash() { + log.Debug("POST not allowed on immutable, list or hash") + Respond(w, req, fmt.Sprintf("POST method on scheme %s not allowed", uri.Scheme), http.StatusMethodNotAllowed) } else { + log.Debug("handlePostFiles") s.HandlePostFiles(w, req) } case "PUT": - // DEPRECATED: - // clients should send a POST request (the request creates a - // new manifest leaving the existing one intact, so it isn't - // strictly a traditional PUT request which replaces content - // at a URI, and POST is more ubiquitous) - if uri.Raw() || uri.DeprecatedRaw() { - ShowError(w, req, fmt.Sprintf("No PUT to %s allowed.", uri), http.StatusBadRequest) - return - } else { - s.HandlePostFiles(w, req) - } + Respond(w, req, fmt.Sprintf("PUT method to %s not allowed", uri), http.StatusBadRequest) + return case "DELETE": - if uri.Raw() || uri.DeprecatedRaw() { - ShowError(w, req, fmt.Sprintf("No DELETE to %s allowed.", uri), http.StatusBadRequest) + if uri.Raw() { + Respond(w, req, fmt.Sprintf("DELETE method to %s not allowed", uri), http.StatusBadRequest) return } s.HandleDelete(w, req) case "GET": - if uri.Raw() || uri.Hash() || uri.DeprecatedRaw() { + + if uri.Resource() { + s.HandleGetResource(w, req) + return + } + + if uri.Raw() || uri.Hash() { s.HandleGet(w, req) return } @@ -725,13 +1103,14 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { s.HandleGetFile(w, req) default: - ShowError(w, req, fmt.Sprintf("Method "+r.Method+" is not supported.", uri), http.StatusMethodNotAllowed) - + Respond(w, req, fmt.Sprintf("%s method is not supported", r.Method), http.StatusMethodNotAllowed) } + + log.Info("served response", "ruid", req.ruid, "code", w.statusCode) } -func (s *Server) updateManifest(key storage.Key, update func(mw *api.ManifestWriter) error) (storage.Key, error) { - mw, err := s.api.NewManifestWriter(key, nil) +func (s *Server) updateManifest(addr storage.Address, update func(mw *api.ManifestWriter) error) (storage.Address, error) { + mw, err := s.api.NewManifestWriter(addr, nil) if err != nil { return nil, err } @@ -740,30 +1119,24 @@ func (s *Server) updateManifest(key storage.Key, update func(mw *api.ManifestWri return nil, err } - key, err = mw.Store() + addr, err = mw.Store() if err != nil { return nil, err } - s.logDebug("generated manifest %s", key) - return key, nil -} - -func (s *Server) logDebug(format string, v ...interface{}) { - log.Debug(fmt.Sprintf("[BZZ] HTTP: "+format, v...)) -} - -func (s *Server) logError(format string, v ...interface{}) { - log.Error(fmt.Sprintf("[BZZ] HTTP: "+format, v...)) + log.Debug(fmt.Sprintf("generated manifest %s", addr)) + return addr, nil } -func (s *Server) BadRequest(w http.ResponseWriter, r *Request, reason string) { - ShowError(w, r, fmt.Sprintf("Bad request %s %s: %s", r.Request.Method, r.uri, reason), http.StatusBadRequest) +type loggingResponseWriter struct { + http.ResponseWriter + statusCode int } -func (s *Server) Error(w http.ResponseWriter, r *Request, err error) { - ShowError(w, r, fmt.Sprintf("Error serving %s %s: %s", r.Request.Method, r.uri, err), http.StatusInternalServerError) +func newLoggingResponseWriter(w http.ResponseWriter) *loggingResponseWriter { + return &loggingResponseWriter{w, http.StatusOK} } -func (s *Server) NotFound(w http.ResponseWriter, r *Request, err error) { - ShowError(w, r, fmt.Sprintf("NOT FOUND error serving %s %s: %s", r.Request.Method, r.uri, err), http.StatusNotFound) +func (lrw *loggingResponseWriter) WriteHeader(code int) { + lrw.statusCode = code + lrw.ResponseWriter.WriteHeader(code) } diff --git a/swarm/api/http/server_test.go b/swarm/api/http/server_test.go index b2efc0ea1..9fb21f7a3 100644 --- a/swarm/api/http/server_test.go +++ b/swarm/api/http/server_test.go @@ -14,39 +14,360 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. -package http_test +package http import ( "bytes" + "crypto/rand" + "encoding/json" "errors" + "flag" "fmt" "io/ioutil" "net/http" + "os" "strings" - "sync" "testing" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/swarm/api" swarm "github.com/ethereum/go-ethereum/swarm/api/client" + "github.com/ethereum/go-ethereum/swarm/multihash" "github.com/ethereum/go-ethereum/swarm/storage" "github.com/ethereum/go-ethereum/swarm/testutil" ) +func init() { + loglevel := flag.Int("loglevel", 2, "loglevel") + flag.Parse() + log.Root().SetHandler(log.CallerFileHandler(log.LvlFilterHandler(log.Lvl(*loglevel), log.StreamHandler(os.Stderr, log.TerminalFormat(true))))) +} + +func TestResourcePostMode(t *testing.T) { + path := "" + errstr := "resourcePostMode for '%s' should be raw %v frequency %d, was raw %v, frequency %d" + r, f, err := resourcePostMode(path) + if err != nil { + t.Fatal(err) + } else if r || f != 0 { + t.Fatalf(errstr, path, false, 0, r, f) + } + + path = "raw" + r, f, err = resourcePostMode(path) + if err != nil { + t.Fatal(err) + } else if !r || f != 0 { + t.Fatalf(errstr, path, true, 0, r, f) + } + + path = "13" + r, f, err = resourcePostMode(path) + if err != nil { + t.Fatal(err) + } else if r || f == 0 { + t.Fatalf(errstr, path, false, 13, r, f) + } + + path = "raw/13" + r, f, err = resourcePostMode(path) + if err != nil { + t.Fatal(err) + } else if !r || f == 0 { + t.Fatalf(errstr, path, true, 13, r, f) + } + + path = "foo/13" + r, f, err = resourcePostMode(path) + if err == nil { + t.Fatal("resourcePostMode for 'foo/13' should fail, returned error nil") + } +} + +func serverFunc(api *api.API) testutil.TestServer { + return NewServer(api) +} + +// test the transparent resolving of multihash resource types with bzz:// scheme +// +// first upload data, and store the multihash to the resulting manifest in a resource update +// retrieving the update with the multihash should return the manifest pointing directly to the data +// and raw retrieve of that hash should return the data +func TestBzzResourceMultihash(t *testing.T) { + + srv := testutil.NewTestSwarmServer(t, serverFunc) + defer srv.Close() + + // add the data our multihash aliased manifest will point to + databytes := "bar" + url := fmt.Sprintf("%s/bzz:/", srv.URL) + resp, err := http.Post(url, "text/plain", bytes.NewReader([]byte(databytes))) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + t.Fatalf("err %s", resp.Status) + } + b, err := ioutil.ReadAll(resp.Body) + + if err != nil { + t.Fatal(err) + } + s := common.FromHex(string(b)) + mh := multihash.ToMultihash(s) + + mhHex := hexutil.Encode(mh) + log.Info("added data", "manifest", string(b), "data", common.ToHex(mh)) + + // our mutable resource "name" + keybytes := "foo.eth" + + // create the multihash update + url = fmt.Sprintf("%s/bzz-resource:/%s/13", srv.URL, keybytes) + resp, err = http.Post(url, "application/octet-stream", bytes.NewReader([]byte(mhHex))) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + t.Fatalf("err %s", resp.Status) + } + b, err = ioutil.ReadAll(resp.Body) + if err != nil { + t.Fatal(err) + } + rsrcResp := &storage.Address{} + err = json.Unmarshal(b, rsrcResp) + if err != nil { + t.Fatalf("data %s could not be unmarshaled: %v", b, err) + } + + correctManifestAddrHex := "d689648fb9e00ddc7ebcf474112d5881c5bf7dbc6e394681b1d224b11b59b5e0" + if rsrcResp.Hex() != correctManifestAddrHex { + t.Fatalf("Response resource key mismatch, expected '%s', got '%s'", correctManifestAddrHex, rsrcResp) + } + + // get bzz manifest transparent resource resolve + url = fmt.Sprintf("%s/bzz:/%s", srv.URL, rsrcResp) + resp, err = http.Get(url) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + t.Fatalf("err %s", resp.Status) + } + b, err = ioutil.ReadAll(resp.Body) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(b, []byte(databytes)) { + t.Fatalf("retrieved data mismatch, expected %x, got %x", databytes, b) + } +} + +// Test resource updates using the raw update methods +func TestBzzResource(t *testing.T) { + srv := testutil.NewTestSwarmServer(t, serverFunc) + defer srv.Close() + + // our mutable resource "name" + keybytes := "foo.eth" + + // data of update 1 + databytes := make([]byte, 666) + _, err := rand.Read(databytes) + if err != nil { + t.Fatal(err) + } + + // creates resource and sets update 1 + url := fmt.Sprintf("%s/bzz-resource:/%s/raw/13", srv.URL, []byte(keybytes)) + resp, err := http.Post(url, "application/octet-stream", bytes.NewReader(databytes)) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + t.Fatalf("err %s", resp.Status) + } + b, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Fatal(err) + } + rsrcResp := &storage.Address{} + err = json.Unmarshal(b, rsrcResp) + if err != nil { + t.Fatalf("data %s could not be unmarshaled: %v", b, err) + } + + correctManifestAddrHex := "d689648fb9e00ddc7ebcf474112d5881c5bf7dbc6e394681b1d224b11b59b5e0" + if rsrcResp.Hex() != correctManifestAddrHex { + t.Fatalf("Response resource key mismatch, expected '%s', got '%s'", correctManifestAddrHex, rsrcResp.Hex()) + } + + // get the manifest + url = fmt.Sprintf("%s/bzz-raw:/%s", srv.URL, rsrcResp) + resp, err = http.Get(url) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + t.Fatalf("err %s", resp.Status) + } + b, err = ioutil.ReadAll(resp.Body) + if err != nil { + t.Fatal(err) + } + manifest := &api.Manifest{} + err = json.Unmarshal(b, manifest) + if err != nil { + t.Fatal(err) + } + if len(manifest.Entries) != 1 { + t.Fatalf("Manifest has %d entries", len(manifest.Entries)) + } + + correctRootKeyHex := "f667277e004e8486c7a3631fd226802430e84e9a81b6085d31f512a591ae0065" + if manifest.Entries[0].Hash != correctRootKeyHex { + t.Fatalf("Expected manifest path '%s', got '%s'", correctRootKeyHex, manifest.Entries[0].Hash) + } + + // get bzz manifest transparent resource resolve + url = fmt.Sprintf("%s/bzz:/%s", srv.URL, rsrcResp) + resp, err = http.Get(url) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + t.Fatalf("err %s", resp.Status) + } + b, err = ioutil.ReadAll(resp.Body) + if err != nil { + t.Fatal(err) + } + + // get non-existent name, should fail + url = fmt.Sprintf("%s/bzz-resource:/bar", srv.URL) + resp, err = http.Get(url) + if err != nil { + t.Fatal(err) + } + resp.Body.Close() + + // get latest update (1.1) through resource directly + log.Info("get update latest = 1.1", "addr", correctManifestAddrHex) + url = fmt.Sprintf("%s/bzz-resource:/%s", srv.URL, correctManifestAddrHex) + resp, err = http.Get(url) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + t.Fatalf("err %s", resp.Status) + } + b, err = ioutil.ReadAll(resp.Body) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(databytes, b) { + t.Fatalf("Expected body '%x', got '%x'", databytes, b) + } + + // update 2 + log.Info("update 2") + url = fmt.Sprintf("%s/bzz-resource:/%s/raw", srv.URL, correctManifestAddrHex) + data := []byte("foo") + resp, err = http.Post(url, "application/octet-stream", bytes.NewReader(data)) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + t.Fatalf("Update returned %s", resp.Status) + } + + // get latest update (1.2) through resource directly + log.Info("get update 1.2") + url = fmt.Sprintf("%s/bzz-resource:/%s", srv.URL, correctManifestAddrHex) + resp, err = http.Get(url) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + t.Fatalf("err %s", resp.Status) + } + b, err = ioutil.ReadAll(resp.Body) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(data, b) { + t.Fatalf("Expected body '%x', got '%x'", data, b) + } + + // get latest update (1.2) with specified period + log.Info("get update latest = 1.2") + url = fmt.Sprintf("%s/bzz-resource:/%s/1", srv.URL, correctManifestAddrHex) + resp, err = http.Get(url) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + t.Fatalf("err %s", resp.Status) + } + b, err = ioutil.ReadAll(resp.Body) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(data, b) { + t.Fatalf("Expected body '%x', got '%x'", data, b) + } + + // get first update (1.1) with specified period and version + log.Info("get first update 1.1") + url = fmt.Sprintf("%s/bzz-resource:/%s/1/1", srv.URL, correctManifestAddrHex) + resp, err = http.Get(url) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + t.Fatalf("err %s", resp.Status) + } + b, err = ioutil.ReadAll(resp.Body) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(databytes, b) { + t.Fatalf("Expected body '%x', got '%x'", databytes, b) + } +} + func TestBzzGetPath(t *testing.T) { + testBzzGetPath(false, t) + testBzzGetPath(true, t) +} +func testBzzGetPath(encrypted bool, t *testing.T) { var err error testmanifest := []string{ - `{"entries":[{"path":"a/","hash":"674af7073604ebfc0282a4ab21e5ef1a3c22913866879ebc0816f8a89896b2ed","contentType":"application/bzz-manifest+json","status":0}]}`, - `{"entries":[{"path":"a","hash":"011b4d03dd8c01f1049143cf9c4c817e4b167f1d1b83e5c6f0f10d89ba1e7bce","contentType":"","status":0},{"path":"b/","hash":"0a87b1c3e4bf013686cdf107ec58590f2004610ee58cc2240f26939f691215f5","contentType":"application/bzz-manifest+json","status":0}]}`, `{"entries":[{"path":"b","hash":"011b4d03dd8c01f1049143cf9c4c817e4b167f1d1b83e5c6f0f10d89ba1e7bce","contentType":"","status":0},{"path":"c","hash":"011b4d03dd8c01f1049143cf9c4c817e4b167f1d1b83e5c6f0f10d89ba1e7bce","contentType":"","status":0}]}`, + `{"entries":[{"path":"a","hash":"011b4d03dd8c01f1049143cf9c4c817e4b167f1d1b83e5c6f0f10d89ba1e7bce","contentType":"","status":0},{"path":"b/","hash":"<key0>","contentType":"application/bzz-manifest+json","status":0}]}`, + `{"entries":[{"path":"a/","hash":"<key1>","contentType":"application/bzz-manifest+json","status":0}]}`, } testrequests := make(map[string]int) - testrequests["/"] = 0 + testrequests["/"] = 2 testrequests["/a/"] = 1 - testrequests["/a/b/"] = 2 + testrequests["/a/b/"] = 0 testrequests["/x"] = 0 testrequests[""] = 0 @@ -54,23 +375,27 @@ func TestBzzGetPath(t *testing.T) { reader := [3]*bytes.Reader{} - key := [3]storage.Key{} + addr := [3]storage.Address{} - srv := testutil.NewTestSwarmServer(t) + srv := testutil.NewTestSwarmServer(t, serverFunc) defer srv.Close() - wg := &sync.WaitGroup{} - for i, mf := range testmanifest { reader[i] = bytes.NewReader([]byte(mf)) - key[i], err = srv.Dpa.Store(reader[i], int64(len(mf)), wg, nil) + var wait func() + addr[i], wait, err = srv.FileStore.Store(reader[i], int64(len(mf)), encrypted) + for j := i + 1; j < len(testmanifest); j++ { + testmanifest[j] = strings.Replace(testmanifest[j], fmt.Sprintf("<key%v>", i), addr[i].Hex(), -1) + } if err != nil { t.Fatal(err) } - wg.Wait() + wait() } - _, err = http.Get(srv.URL + "/bzz-raw:/" + common.ToHex(key[0])[2:] + "/a") + rootRef := addr[2].Hex() + + _, err = http.Get(srv.URL + "/bzz-raw:/" + rootRef + "/a") if err != nil { t.Fatalf("Failed to connect to proxy: %v", err) } @@ -81,7 +406,7 @@ func TestBzzGetPath(t *testing.T) { url := srv.URL + "/bzz-raw:/" if k[:] != "" { - url += common.ToHex(key[0])[2:] + "/" + k[1:] + "?content_type=text/plain" + url += rootRef + "/" + k[1:] + "?content_type=text/plain" } resp, err = http.Get(url) if err != nil { @@ -110,7 +435,7 @@ func TestBzzGetPath(t *testing.T) { url := srv.URL + "/bzz-hash:/" if k[:] != "" { - url += common.ToHex(key[0])[2:] + "/" + k[1:] + url += rootRef + "/" + k[1:] } resp, err = http.Get(url) if err != nil { @@ -122,7 +447,7 @@ func TestBzzGetPath(t *testing.T) { t.Fatalf("Read request body: %v", err) } - if string(respbody) != key[v].String() { + if string(respbody) != addr[v].Hex() { isexpectedfailrequest := false for _, r := range expectedfailrequests { @@ -131,11 +456,13 @@ func TestBzzGetPath(t *testing.T) { } } if !isexpectedfailrequest { - t.Fatalf("Response body does not match, expected: %v, got %v", key[v], string(respbody)) + t.Fatalf("Response body does not match, expected: %v, got %v", addr[v], string(respbody)) } } } + ref := addr[2].Hex() + for _, c := range []struct { path string json string @@ -144,17 +471,17 @@ func TestBzzGetPath(t *testing.T) { { path: "/", json: `{"common_prefixes":["a/"]}`, - html: "<!DOCTYPE html>\n<html>\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\t\t<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHsAAAB5CAYAAAAZD150AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3Ln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2ljvKWNcTNlO8ceWcYle3vBzeapGPfJzFgZjKQCkQNlWLLb9XWRQOufoffygSWUeUOzeQrlngLG3cjWuhTEOBTZASNz/hTjZWVBKI/srEZ74PY2MEA6ETW4wC7MXXvVdxiytWQV8CVIvpoMeQM1Fdm9jfG1xTEWJpspqG/VUozXgO6BMhGWTbZ1M8/dUMibaPgb2O/neoqQbX7+ZMNVjAr+in0HJkUsitsqE+u0axvj8ewPwDiQbPPjQz/Jl8F4Cfu+Ri0do4VUKUfT151Fte3P7fs6AXDcc57twIT+Me2XL2L/dlIdxV8mOruN0YhkF4w9yZ4oxqrJlhy/VXRstNg4GZs/hmNjukEh3ci2TmuJat2KO7sCm/kmx8MOinhkohIwGngSo3PfHMYVZOcxXtnGWGYgpyv4SZAdCjZg8dPtgIUvJ5yqdZJtS+drDsknUMA32LdhzJKI8ZVgJA6RvoBpY1xGthiZORD4yYIiE8M4SbIDaX5o7lws4GWcIGacunEDF3yJKflvqP4o+1rGLMtOYPw1ML4cEASeEkfvvl8Qo4Gfj6X7/DdJmQbZAZ9BmRNQxOsIwX4XBVzBhR+Ei6tkG4IyjNxb38fqxwqKzLpOHLTtRRrwqnWmYYpx71WOcaYJmld+roG5BuYamGtgroG5BuYamJoG/h/ff6XOIB4wOAAAAABJRU5ErkJggg==\"/>\n\t<title>Swarm index of bzz:/262e5c08c03c2789b6daef487dfa14b4d132f5340d781a3ecb1d5122ab65640c/</title>\n</head>\n\n<body>\n <h1>Swarm index of bzz:/262e5c08c03c2789b6daef487dfa14b4d132f5340d781a3ecb1d5122ab65640c/</h1>\n <hr>\n <table>\n <thead>\n <tr>\n\t<th>Path</th>\n\t<th>Type</th>\n\t<th>Size</th>\n </tr>\n </thead>\n\n <tbody>\n \n\t<tr>\n\t <td><a href=\"a/\">a/</a></td>\n\t <td>DIR</td>\n\t <td>-</td>\n\t</tr>\n \n\n \n </table>\n <hr>\n</body>\n", + html: fmt.Sprintf("<!DOCTYPE html>\n<html>\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\t\t<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHsAAAB5CAYAAAAZD150AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAAFzFJREFUeAHtnXuwJFV9x7vnzrKwIC95w/ImYFkxlZgiGswCIiCGxPhHCEIwmIemUqYwJkYrJmXlUZRa+IpAWYYEk4qJD4gJGAmoiBIxMQFRQCkXdhdCeL+fYdk7nc+ne87dvnPn0TPTPdNzmd/W2X6fc76/7/n9zjm/PrcniuYy18BcA3MNzDUw18BcA3MNzDUw18BcA3MNrGYNLERroyMAeNQ0QcbTLPxFUfaOOx4Wbd12ThRHp0TJ4s5RFF8RtVoXg/2BSeOfk12lxtc0fjva1jibItZEDf4li3u3i3sqipOPRIvRp6ssvjPvhc4Tq/y4Ab71pEXS1oqw7hw1mz8XJc2LoiQ6iTJaaTkxth0l69jXwNayOZ10AvubSQ+RrFOl8mKy7EOiRuN3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/>\n\t<title>Swarm index of bzz:/%s/</title>\n</head>\n\n<body>\n <h1>Swarm index of bzz:/%s/</h1>\n <hr>\n <table>\n <thead>\n <tr>\n\t<th>Path</th>\n\t<th>Type</th>\n\t<th>Size</th>\n </tr>\n </thead>\n\n <tbody>\n \n\t<tr>\n\t <td><a href=\"a/\">a/</a></td>\n\t <td>DIR</td>\n\t <td>-</td>\n\t</tr>\n \n\n \n </table>\n <hr>\n</body>\n", ref, ref), }, { path: "/a/", json: `{"common_prefixes":["a/b/"],"entries":[{"hash":"011b4d03dd8c01f1049143cf9c4c817e4b167f1d1b83e5c6f0f10d89ba1e7bce","path":"a/a","mod_time":"0001-01-01T00:00:00Z"}]}`, - html: "<!DOCTYPE html>\n<html>\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\t\t<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHsAAAB5CAYAAAAZD150AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0Y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IT+Me2XL2L/dlIdxV8mOruN0YhkF4w9yZ4oxqrJlhy/VXRstNg4GZs/hmNjukEh3ci2TmuJat2KO7sCm/kmx8MOinhkohIwGngSo3PfHMYVZOcxXtnGWGYgpyv4SZAdCjZg8dPtgIUvJ5yqdZJtS+drDsknUMA32LdhzJKI8ZVgJA6RvoBpY1xGthiZORD4yYIiE8M4SbIDaX5o7lws4GWcIGacunEDF3yJKflvqP4o+1rGLMtOYPw1ML4cEASeEkfvvl8Qo4Gfj6X7/DdJmQbZAZ9BmRNQxOsIwX4XBVzBhR+Ei6tkG4IyjNxb38fqxwqKzLpOHLTtRRrwqnWmYYpx71WOcaYJmld+roG5BuYamGtgroG5BuYamJoG/h/ff6XOIB4wOAAAAABJRU5ErkJggg==\"/>\n\t<title>Swarm index of bzz:/262e5c08c03c2789b6daef487dfa14b4d132f5340d781a3ecb1d5122ab65640c/a/</title>\n</head>\n\n<body>\n <h1>Swarm index of bzz:/262e5c08c03c2789b6daef487dfa14b4d132f5340d781a3ecb1d5122ab65640c/a/</h1>\n <hr>\n <table>\n <thead>\n <tr>\n\t<th>Path</th>\n\t<th>Type</th>\n\t<th>Size</th>\n </tr>\n </thead>\n\n <tbody>\n \n\t<tr>\n\t <td><a href=\"b/\">b/</a></td>\n\t <td>DIR</td>\n\t <td>-</td>\n\t</tr>\n \n\n \n\t<tr>\n\t <td><a href=\"a\">a</a></td>\n\t <td></td>\n\t <td>0</td>\n\t</tr>\n \n </table>\n <hr>\n</body>\n", + html: fmt.Sprintf("<!DOCTYPE html>\n<html>\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\t\t<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHsAAAB5CAYAAAAZD150AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZ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jL5mGk1HIDiUchUJORCHHcsJ8RiF9XLJVwAIkX4tFXkl7vy1UrqTtkW2MP0N+Y2Aci2wxNtsYrxgH4zhkq09d3SHtr/zvx77hy2FkHLKZVjH4Wmx9kAI3kcroVrrVXYwHtzHuz/4IGEcmm2ljvKWNcTNlO8ceWcYle3vBzeapGPfJzFgZjKQCkQNlWLLb9XWRQOufoffygSWUeUOzeQrlngLG3cjWuhTEOBTZASNz/hTjZWVBKI/srEZ74PY2MEA6ETW4wC7MXXvVdxiytWQV8CVIvpoMeQM1Fdm9jfG1xTEWJpspqG/VUozXgO6BMhGWTbZ1M8/dUMibaPgb2O/neoqQbX7+ZMNVjAr+in0HJkUsitsqE+u0axvj8ewPwDiQbPPjQz/Jl8F4Cfu+Ri0do4VUKUfT151Fte3P7fs6AXDcc57twIT+Me2XL2L/dlIdxV8mOruN0YhkF4w9yZ4oxqrJlhy/VXRstNg4GZs/hmNjukEh3ci2TmuJat2KO7sCm/kmx8MOinhkohIwGngSo3PfHMYVZOcxXtnGWGYgpyv4SZAdCjZg8dPtgIUvJ5yqdZJtS+drDsknUMA32LdhzJKI8ZVgJA6RvoBpY1xGthiZORD4yYIiE8M4SbIDaX5o7lws4GWcIGacunEDF3yJKflvqP4o+1rGLMtOYPw1ML4cEASeEkfvvl8Qo4Gfj6X7/DdJmQbZAZ9BmRNQxOsIwX4XBVzBhR+Ei6tkG4IyjNxb38fqxwqKzLpOHLTtRRrwqnWmYYpx71WOcaYJmld+roG5BuYamGtgroG5BuYamJoG/h/ff6XOIB4wOAAAAABJRU5ErkJggg==\"/>\n\t<title>Swarm index of bzz:/%s/a/</title>\n</head>\n\n<body>\n <h1>Swarm index of bzz:/%s/a/</h1>\n <hr>\n <table>\n <thead>\n <tr>\n\t<th>Path</th>\n\t<th>Type</th>\n\t<th>Size</th>\n </tr>\n </thead>\n\n <tbody>\n \n\t<tr>\n\t <td><a href=\"b/\">b/</a></td>\n\t <td>DIR</td>\n\t <td>-</td>\n\t</tr>\n \n\n \n\t<tr>\n\t <td><a href=\"a\">a</a></td>\n\t <td></td>\n\t <td>0</td>\n\t</tr>\n \n </table>\n <hr>\n</body>\n", ref, ref), }, { path: "/a/b/", json: `{"entries":[{"hash":"011b4d03dd8c01f1049143cf9c4c817e4b167f1d1b83e5c6f0f10d89ba1e7bce","path":"a/b/b","mod_time":"0001-01-01T00:00:00Z"},{"hash":"011b4d03dd8c01f1049143cf9c4c817e4b167f1d1b83e5c6f0f10d89ba1e7bce","path":"a/b/c","mod_time":"0001-01-01T00:00:00Z"}]}`, - html: "<!DOCTYPE html>\n<html>\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\t\t<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHsAAAB5CAYAAAAZD150AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAAFzFJREFUeAHtnXuwJFV9x7vnzrKwIC95w/ImYFkxlZgiGswCIiCGxPhHCEIwmIemUqYwJk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m/kmx8MOinhkohIwGngSo3PfHMYVZOcxXtnGWGYgpyv4SZAdCjZg8dPtgIUvJ5yqdZJtS+drDsknUMA32LdhzJKI8ZVgJA6RvoBpY1xGthiZORD4yYIiE8M4SbIDaX5o7lws4GWcIGacunEDF3yJKflvqP4o+1rGLMtOYPw1ML4cEASeEkfvvl8Qo4Gfj6X7/DdJmQbZAZ9BmRNQxOsIwX4XBVzBhR+Ei6tkG4IyjNxb38fqxwqKzLpOHLTtRRrwqnWmYYpx71WOcaYJmld+roG5BuYamGtgroG5BuYamJoG/h/ff6XOIB4wOAAAAABJRU5ErkJggg==\"/>\n\t<title>Swarm index of bzz:/262e5c08c03c2789b6daef487dfa14b4d132f5340d781a3ecb1d5122ab65640c/a/b/</title>\n</head>\n\n<body>\n <h1>Swarm index of bzz:/262e5c08c03c2789b6daef487dfa14b4d132f5340d781a3ecb1d5122ab65640c/a/b/</h1>\n <hr>\n <table>\n <thead>\n <tr>\n\t<th>Path</th>\n\t<th>Type</th>\n\t<th>Size</th>\n </tr>\n </thead>\n\n <tbody>\n \n\n \n\t<tr>\n\t <td><a href=\"b\">b</a></td>\n\t <td></td>\n\t <td>0</td>\n\t</tr>\n \n\t<tr>\n\t <td><a href=\"c\">c</a></td>\n\t <td></td>\n\t <td>0</td>\n\t</tr>\n \n </table>\n <hr>\n</body>\n", + html: fmt.Sprintf("<!DOCTYPE html>\n<html>\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\t\t<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHsAAAB5CAYAAAAZD150AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNU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zhkq09d3SHtr/zvx77hy2FkHLKZVjH4Wmx9kAI3kcroVrrVXYwHtzHuz/4IGEcmm2ljvKWNcTNlO8ceWcYle3vBzeapGPfJzFgZjKQCkQNlWLLb9XWRQOufoffygSWUeUOzeQrlngLG3cjWuhTEOBTZASNz/hTjZWVBKI/srEZ74PY2MEA6ETW4wC7MXXvVdxiytWQV8CVIvpoMeQM1Fdm9jfG1xTEWJpspqG/VUozXgO6BMhGWTbZ1M8/dUMibaPgb2O/neoqQbX7+ZMNVjAr+in0HJkUsitsqE+u0axvj8ewPwDiQbPPjQz/Jl8F4Cfu+Ri0do4VUKUfT151Fte3P7fs6AXDcc57twIT+Me2XL2L/dlIdxV8mOruN0YhkF4w9yZ4oxqrJlhy/VXRstNg4GZs/hmNjukEh3ci2TmuJat2KO7sCm/kmx8MOinhkohIwGngSo3PfHMYVZOcxXtnGWGYgpyv4SZAdCjZg8dPtgIUvJ5yqdZJtS+drDsknUMA32LdhzJKI8ZVgJA6RvoBpY1xGthiZORD4yYIiE8M4SbIDaX5o7lws4GWcIGacunEDF3yJKflvqP4o+1rGLMtOYPw1ML4cEASeEkfvvl8Qo4Gfj6X7/DdJmQbZAZ9BmRNQxOsIwX4XBVzBhR+Ei6tkG4IyjNxb38fqxwqKzLpOHLTtRRrwqnWmYYpx71WOcaYJmld+roG5BuYamGtgroG5BuYamJoG/h/ff6XOIB4wOAAAAABJRU5ErkJggg==\"/>\n\t<title>Swarm index of bzz:/%s/a/b/</title>\n</head>\n\n<body>\n <h1>Swarm index of bzz:/%s/a/b/</h1>\n <hr>\n <table>\n <thead>\n <tr>\n\t<th>Path</th>\n\t<th>Type</th>\n\t<th>Size</th>\n </tr>\n </thead>\n\n <tbody>\n \n\n \n\t<tr>\n\t <td><a href=\"b\">b</a></td>\n\t <td></td>\n\t <td>0</td>\n\t</tr>\n \n\t<tr>\n\t <td><a href=\"c\">c</a></td>\n\t <td></td>\n\t <td>0</td>\n\t</tr>\n \n </table>\n <hr>\n</body>\n", ref, ref), }, { path: "/x", @@ -166,7 +493,7 @@ func TestBzzGetPath(t *testing.T) { k := c.path url := srv.URL + "/bzz-list:/" if k[:] != "" { - url += common.ToHex(key[0])[2:] + "/" + k[1:] + url += rootRef + "/" + k[1:] } t.Run("json list "+c.path, func(t *testing.T) { resp, err := http.Get(url) @@ -233,11 +560,11 @@ func TestBzzGetPath(t *testing.T) { } nonhashresponses := []string{ - "error resolving name: no DNS to resolve name: "name"", - "error resolving nonhash: immutable address not a content hash: "nonhash"", - "error resolving nonhash: no DNS to resolve name: "nonhash"", - "error resolving nonhash: no DNS to resolve name: "nonhash"", - "error resolving nonhash: no DNS to resolve name: "nonhash"", + "cannot resolve name: no DNS to resolve name: "name"", + "cannot resolve nonhash: immutable address not a content hash: "nonhash"", + "cannot resolve nonhash: no DNS to resolve name: "nonhash"", + "cannot resolve nonhash: no DNS to resolve name: "nonhash"", + "cannot resolve nonhash: no DNS to resolve name: "nonhash"", } for i, url := range nonhashtests { @@ -258,14 +585,20 @@ func TestBzzGetPath(t *testing.T) { t.Fatalf("Non-Hash response body does not match, expected: %v, got: %v", nonhashresponses[i], string(respbody)) } } - } // TestBzzRootRedirect tests that getting the root path of a manifest without // a trailing slash gets redirected to include the trailing slash so that // relative URLs work as expected. func TestBzzRootRedirect(t *testing.T) { - srv := testutil.NewTestSwarmServer(t) + testBzzRootRedirect(false, t) +} +func TestBzzRootRedirectEncrypted(t *testing.T) { + testBzzRootRedirect(true, t) +} + +func testBzzRootRedirect(toEncrypt bool, t *testing.T) { + srv := testutil.NewTestSwarmServer(t, serverFunc) defer srv.Close() // create a manifest with some data at the root path @@ -279,7 +612,7 @@ func TestBzzRootRedirect(t *testing.T) { Size: int64(len(data)), }, } - hash, err := client.Upload(file, "") + hash, err := client.Upload(file, "", toEncrypt) if err != nil { t.Fatal(err) } @@ -318,3 +651,31 @@ func TestBzzRootRedirect(t *testing.T) { t.Fatalf("expected response to equal %q, got %q", data, gotData) } } + +func TestMethodsNotAllowed(t *testing.T) { + srv := testutil.NewTestSwarmServer(t, serverFunc) + defer srv.Close() + databytes := "bar" + for _, c := range []struct { + url string + code int + }{ + { + url: fmt.Sprintf("%s/bzz-list:/", srv.URL), + code: 405, + }, { + url: fmt.Sprintf("%s/bzz-hash:/", srv.URL), + code: 405, + }, + { + url: fmt.Sprintf("%s/bzz-immutable:/", srv.URL), + code: 405, + }, + } { + res, _ := http.Post(c.url, "text/plain", bytes.NewReader([]byte(databytes))) + if res.StatusCode != c.code { + t.Fatal("should have failed") + } + } + +} diff --git a/swarm/api/http/templates.go b/swarm/api/http/templates.go index cd9d21289..ffd816493 100644 --- a/swarm/api/http/templates.go +++ b/swarm/api/http/templates.go @@ -78,7 +78,6 @@ var landingPageTemplate = template.Must(template.New("landingPage").Parse(` <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> <meta http-equiv="X-UA-Compatible" ww="chrome=1"> <meta name="description" content="Ethereum/Swarm Landing page"> - <meta property="og:url" content="https://swarm-gateways.net/bzz:/theswarm.eth"> <style> body, div, header, footer { @@ -206,7 +205,7 @@ var landingPageTemplate = template.Must(template.New("landingPage").Parse(` <footer> <p> Swarm: Serverless Hosting Incentivised Peer-To-Peer Storage And Content Distribution<br/> - <a href="http://swarm-gateways.net/bzz:/theswarm.eth">Swarm</a> + <a href="/bzz:/theswarm.eth">Swarm</a> </p> </footer> |