summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorache <ache@ache.one>2019-09-25 13:54:01 +0200
committerache <ache@ache.one>2019-09-25 13:54:01 +0200
commit7003bb71e69d81b0c248ee37d39966661f9fedd6 (patch)
tree3fcebae4203fbf8f6a616ad0896dced614f973fc
parentConfig hosts (diff)
Add handlePropfind
-rw-r--r--server.go10
1 files 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();