diff --git a/bzz/bzzup/bzzhandler.html b/bzz/bzzup/bzzhandler.html new file mode 100644 index 0000000000..0d7a8b01a4 --- /dev/null +++ b/bzz/bzzup/bzzhandler.html @@ -0,0 +1,15 @@ + + + + Register Swarm protocol handler + + + +

Register Swarm protocol handler

+

This web page will install a web protocol handler for the bzz: protocol.

+ + diff --git a/bzz/httpaccess.go b/bzz/httpaccess.go index bfa85887e6..839b534ae6 100644 --- a/bzz/httpaccess.go +++ b/bzz/httpaccess.go @@ -20,6 +20,7 @@ const ( ) var ( + protocolMatcher = regexp.MustCompile("^/bzz:") uriMatcher = regexp.MustCompile("^/raw/[0-9A-Fa-f]{64}(?:/[a-z]+/[-+0-9a-z]+)?$") manifestMatcher = regexp.MustCompile("^/[0-9A-Fa-f]{64}") hashMatcher = regexp.MustCompile("^[0-9A-Fa-f]{64}$") @@ -94,7 +95,7 @@ func (self *sequentialReader) ReadAt(target []byte, off int64) (n int, err error } func handler(w http.ResponseWriter, r *http.Request, dpa *DPA) { - uri := r.RequestURI + uri := protocolMatcher.ReplaceAllString(r.RequestURI, "") switch { case r.Method == "POST": if uri == "/raw" {