mirror of
https://github.com/hacdias/webdav.git
synced 2026-09-26 21:21:54 +08:00
refactor: cleanup
License: MIT Signed-off-by: Henrique Dias <[email protected]>
This commit is contained in:
@@ -1,11 +1,20 @@
|
|||||||
package webdav
|
package webdav
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/net/webdav"
|
"golang.org/x/net/webdav"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Rule is a dissalow/allow rule.
|
||||||
|
type Rule struct {
|
||||||
|
Regex bool
|
||||||
|
Allow bool
|
||||||
|
Path string
|
||||||
|
Regexp *regexp.Regexp
|
||||||
|
}
|
||||||
|
|
||||||
// User contains the settings of each user.
|
// User contains the settings of each user.
|
||||||
type User struct {
|
type User struct {
|
||||||
Username string
|
Username string
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"regexp"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config is the configuration of a WebDAV instance.
|
// Config is the configuration of a WebDAV instance.
|
||||||
@@ -84,14 +83,6 @@ func (c *Config) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
u.Handler.ServeHTTP(w, r)
|
u.Handler.ServeHTTP(w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rule is a dissalow/allow rule.
|
|
||||||
type Rule struct {
|
|
||||||
Regex bool
|
|
||||||
Allow bool
|
|
||||||
Path string
|
|
||||||
Regexp *regexp.Regexp
|
|
||||||
}
|
|
||||||
|
|
||||||
// responseWriterNoBody is a wrapper used to suprress the body of the response
|
// responseWriterNoBody is a wrapper used to suprress the body of the response
|
||||||
// to a request. Mainly used for HEAD requests.
|
// to a request. Mainly used for HEAD requests.
|
||||||
type responseWriterNoBody struct {
|
type responseWriterNoBody struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user