flounder

A simple gemini site builder
git clone git://git.alexwennerberg.com/flounder
Log | Files | Refs | README | LICENSE

commit 7e163707f2dd7f197bea26d8980af7d010f24b89
parent 4ae5860cdcdf8dc4c035574c7e97de4d641423aa
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Sun, 23 Oct 2022 15:19:53 -0700

stop annoying bots

Diffstat:
Mhttp.go | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/http.go b/http.go @@ -578,6 +578,12 @@ func adminHandler(w http.ResponseWriter, r *http.Request) { // Here be dragons func userFile(w http.ResponseWriter, r *http.Request) { var userName string + // stop annoying bots + count := strings.Count(r.Host, ".") + if count > 2 { + http.Error(w, "", 000) + return + } custom := domains[r.Host] if custom != "" { userName = custom @@ -896,7 +902,9 @@ func runHTTPServer() { // Deprecated serveMux.HandleFunc("proxy."+hostname+"/", proxyGemini) + serveMux.HandleFunc("/", userFile) + srv := &http.Server{ ReadTimeout: 5 * time.Second, WriteTimeout: 10 * time.Second,