]> Sergey Matveev's repositories - tofuproxy.git/blobdiff - rounds/redirectHTML.go
Unify copyright comment format
[tofuproxy.git] / rounds / redirectHTML.go
index e20f7b282bbbb115f40960c935d31b57bb25eac9..4f8dec3c437f29de611d7039c1e94067a7efb7ea 100644 (file)
@@ -1,20 +1,18 @@
-/*
-tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
-             manager, WARC/geminispace browser
-Copyright (C) 2021-2022 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
-the Free Software Foundation, version 3 of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
+// tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
+//              manager, WARC/geminispace browser
+// Copyright (C) 2021-2024 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
+// the Free Software Foundation, version 3 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 package rounds
 
@@ -82,14 +80,13 @@ func RoundRedirectHTML(
        w.Header().Add("Content-Type", "text/html")
        w.WriteHeader(http.StatusOK)
        location := resp.Header.Get("Location")
-       w.Write([]byte(
-               fmt.Sprintf(
-                       `<!DOCTYPE html>
+       fmt.Fprintf(
+               w, `<!DOCTYPE html>
 <html><head><title>%d %s: %s redirection</title></head>
 <body><a href="%s">%s</a></body></html>`,
-                       resp.StatusCode, http.StatusText(resp.StatusCode),
-                       redirType, location, location,
-               )))
+               resp.StatusCode, http.StatusText(resp.StatusCode),
+               redirType, location, location,
+       )
        fifos.LogRedir <- fmt.Sprintf(
                "%s %s\t%s\t%s", req.Method, req.URL, resp.Status, location,
        )