]> Sergey Matveev's repositories - godlighty.git/blobdiff - handler.go
Do not print raw URL path
[godlighty.git] / handler.go
index df16c38d5e11bf05092f7c6b1bcaf606be8a87c7..4593a2f119262608082414f00e9da6713dd75260 100644 (file)
@@ -69,7 +69,7 @@ func (h Handler) Handle(
        host string, cfg *HostCfg,
 ) {
        notFound := func() {
-               fmt.Printf("%s %s \"%s %s %s\" %d \"%s\"\n",
+               fmt.Printf("%s %s \"%s %+q %s\" %d \"%s\"\n",
                        r.RemoteAddr, host, r.Method, r.URL.Path, r.Proto,
                        http.StatusNotFound,
                        r.Header.Get("User-Agent"),
@@ -90,7 +90,7 @@ func (h Handler) Handle(
                username = "user:" + username + " "
        }
        printErr := func(code int, err error) {
-               fmt.Printf("%s %s \"%s %s %s\" %d \"%s\" %s\"%s\"\n",
+               fmt.Printf("%s %s \"%s %+q %s\" %d \"%s\" %s\"%s\"\n",
                        r.RemoteAddr, host, r.Method, r.URL.Path, r.Proto,
                        code, err.Error(),
                        username, r.Header.Get("User-Agent"),
@@ -139,7 +139,7 @@ func (h Handler) Handle(
                }
                wc := &CountResponseWriter{ResponseWriter: w}
                dav.ServeHTTP(wc, r)
-               fmt.Printf("%s %s \"WebDAV %s\" %d %d %s\"%s\"\n",
+               fmt.Printf("%s %s \"WebDAV %+q\" %d %d %s\"%s\"\n",
                        r.RemoteAddr, host, r.URL.Path,
                        wc.Status, wc.Size,
                        username, r.Header.Get("User-Agent"),
@@ -148,7 +148,7 @@ func (h Handler) Handle(
        }
 
        if !(r.Method == "" || r.Method == http.MethodGet) {
-               fmt.Printf("%s %s \"%s %s %s\" %d %s\"%s\"\n",
+               fmt.Printf("%s %s \"%s %+q %s\" %d %s\"%s\"\n",
                        r.RemoteAddr, host, r.Method, r.URL.Path, r.Proto,
                        http.StatusMethodNotAllowed,
                        username, r.Header.Get("User-Agent"),
@@ -285,7 +285,7 @@ IndexLookup:
                wr := wc.(*gzipResponseWriter)
                w.WriteHeader(wr.status)
                w.Write(bufCompressed.Bytes())
-               fmt.Printf("%s %s \"%s %s %s\" %d %d %s\"%s\"\n",
+               fmt.Printf("%s %s \"%s %+q %s\" %d %d %s\"%s\"\n",
                        r.RemoteAddr, host, r.Method, r.URL.Path, r.Proto,
                        wr.status, size,
                        username, r.Header.Get("User-Agent"),
@@ -293,7 +293,7 @@ IndexLookup:
                return
        }
        wr := wc.(*CountResponseWriter)
-       fmt.Printf("%s %s \"%s %s %s\" %d %d %s\"%s\"\n",
+       fmt.Printf("%s %s \"%s %+q %s\" %d %d %s\"%s\"\n",
                r.RemoteAddr, host, r.Method, r.URL.Path, r.Proto,
                wr.Status, wr.Size,
                username, r.Header.Get("User-Agent"),