/*
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
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"),
)
}