]> Sergey Matveev's repositories - godlighty.git/blobdiff - rc/redirect.go
Better URL escaping in output
[godlighty.git] / rc / redirect.go
index 86a62107d090580353d3956e509721cc7fbe9862..677479f61560fbccc41fd6e1c586733542043a27 100644 (file)
@@ -20,16 +20,18 @@ package rc
 import (
        "fmt"
        "net/http"
+
+       "go.stargrave.org/godlighty"
 )
 
-func redirect(
+func Redirect(
        host string,
        w http.ResponseWriter, r *http.Request,
        to string, status int,
 ) {
        http.Redirect(w, r, to, status)
-       fmt.Printf("%s %s \"%s %s %s\" %d \"%s\"\n",
-               r.RemoteAddr, host, r.Method, r.URL.Path, r.Proto,
+       fmt.Printf("%s %s \"%s %+q %s\" %d \"%s\"\n",
+               r.RemoteAddr, host, r.Method, godlighty.PathWithQuery(r.URL), r.Proto,
                status, r.Header.Get("User-Agent"),
        )
 }