webdav: add minimal server implementation

This commit is contained in:
Simon Ser
2020-01-15 18:21:27 +01:00
parent 42765234a8
commit ae93da82c1
4 changed files with 296 additions and 8 deletions

View File

@@ -25,6 +25,19 @@ const (
DepthInfinity Depth = -1
)
// ParseDepth parses a Depth header.
func ParseDepth(s string) (Depth, error) {
switch s {
case "0":
return DepthZero, nil
case "1":
return DepthOne, nil
case "infinity":
return DepthInfinity, nil
}
return 0, fmt.Errorf("webdav: invalid Depth value")
}
// String formats the depth.
func (d Depth) String() string {
switch d {