From 7003bb71e69d81b0c248ee37d39966661f9fedd6 Mon Sep 17 00:00:00 2001 From: ache Date: Wed, 25 Sep 2019 13:54:01 +0200 Subject: Add handlePropfind --- server.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server.go b/server.go index 7ef143b..0cb812e 100644 --- a/server.go +++ b/server.go @@ -16,6 +16,7 @@ import ( ) var tmpl *template.Template; +var tmplXML *template.Template; func verifyEmptyBody( w http.ResponseWriter, r *http.Request) error { // 8.4 RFC4918 - Must return 415 (Unsupported Media Type) if body and should not. @@ -31,7 +32,7 @@ func verifyEmptyBody( w http.ResponseWriter, r *http.Request) error { return nil } func encodeURL( urlStr string ) string { - url,err := url.Parse("http://localhost" + urlStr) + url, err := url.Parse("http://localhost" + urlStr) if err == nil { return url.RequestURI() } @@ -262,7 +263,6 @@ func handleOptions( w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK); } func handleCopy( w http.ResponseWriter, r *http.Request) { - fmt.Println("The body of the request isn't empty. It should be.") } func handleMove( w http.ResponseWriter, r *http.Request) { @@ -338,6 +338,9 @@ func handleMove( w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusCreated) } } +func handlePropfind( w http.ResponseWriter, r *http.Request) { + +} func handleMethod( w http.ResponseWriter, r *http.Request) { switch r.Method { @@ -360,6 +363,8 @@ func handleMethod( w http.ResponseWriter, r *http.Request) { fallthrough case "UNLOCK": fallthrough + case "PROPFIND": + handlePropfind(w, r) case http.MethodPost: w.WriteHeader(http.StatusTeapot) fmt.Fprintln(w, "Sry, will be implemented \"soon\"") @@ -416,6 +421,7 @@ func main() { "formatSize": normaliseSize, } tmpl = template.Must(template.New("dir.html").Funcs(fmap).ParseFiles("dir.html")) + tmplXML = template.Must(template.New("xml.tmpl").Funcs(fmap).ParseFiles("xml.tmpl")) baseWd,_ := os.Getwd(); -- cgit v1.2.3