]> Sergey Matveev's repositories - tofuproxy.git/blobdiff - rounds/gemini.go
Various refactoring
[tofuproxy.git] / rounds / gemini.go
index 43cf422f5db1600c832c678b503db0dfead8d6e6..8d61848397e37538f8840cf4ad5bd22460f99277 100644 (file)
@@ -1,6 +1,6 @@
 /*
-tofuproxy -- flexible HTTP proxy, TLS terminator, X.509 certificates
-             manager, WARC/Gemini browser
+tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
+             manager, WARC/geminispace browser
 Copyright (C) 2021 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
@@ -94,6 +94,12 @@ func RoundGemini(
        }
        paths := strings.Split(strings.TrimPrefix(req.URL.Path, "/"), "/")
        host, paths = paths[0], paths[1:]
+       if host == "gemini:" {
+               http.Redirect(w, req, strings.Join(
+                       append([]string{GeminiEntrypoint}, paths[1:]...), "/",
+               ), http.StatusTemporaryRedirect)
+               return false, nil
+       }
        hostWithPort := host
        if !strings.Contains(hostWithPort, ":") {
                hostWithPort += GeminiPort