Formatting, long options
This commit is contained in:
parent
81bb79e8de
commit
1807f374ca
|
@ -2,17 +2,18 @@ package main
|
|||
|
||||
import (
|
||||
"flag"
|
||||
"golang.org/x/net/webdav"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/net/webdav"
|
||||
)
|
||||
|
||||
type Handler struct {
|
||||
webdav.Handler
|
||||
}
|
||||
|
||||
func (h *Handler)ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.Method {
|
||||
case "GET", "HEAD":
|
||||
if strings.HasSuffix(r.URL.Path, "/") {
|
||||
|
@ -22,10 +23,9 @@ func (h *Handler)ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
h.Handler.ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
|
||||
func main() {
|
||||
address := flag.String("a", ":8080", "Address to listen to")
|
||||
directory := flag.String("d", ".", "Directory to serve")
|
||||
address := flag.String("listen", ":8080", "Address to listen to")
|
||||
directory := flag.String("root", ".", "Directory to serve")
|
||||
flag.Parse()
|
||||
|
||||
handler := &Handler{}
|
||||
|
|
Loading…
Reference in New Issue