]> Sergey Matveev's repositories - godlighty.git/blobdiff - rc/redirect.go
.minisig, .sig
[godlighty.git] / rc / redirect.go
index ecbdbfb98c048b9daecb27d579aa2dca50b98eb5..5b3737c51ff2e807ac08fd53a18465982f303ac7 100644 (file)
@@ -1,6 +1,6 @@
 /*
 godlighty -- highly-customizable HTTP, HTTP/2, HTTPS server
-Copyright (C) 2021 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2021-2023 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -20,6 +20,8 @@ package rc
 import (
        "fmt"
        "net/http"
+
+       "go.stargrave.org/godlighty"
 )
 
 func Redirect(
@@ -28,8 +30,8 @@ func Redirect(
        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"),
        )
 }