summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-12 16:04:08 -0600
committerJeff Carr <[email protected]>2024-01-12 16:04:08 -0600
commit96cd3c3524bf34292970fa28f941334aa56d9c62 (patch)
tree3a88f70b94f241116f8c8591190ac376f72ab504 /main.go
parentf47585ff550a058a025511a3235aad0d3ced3ccf (diff)
running at go.wit.com for the first time
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'main.go')
-rw-r--r--main.go17
1 files changed, 12 insertions, 5 deletions
diff --git a/main.go b/main.go
index 9642cb9..b6793e0 100644
--- a/main.go
+++ b/main.go
@@ -11,17 +11,24 @@ import (
//go:embed files/*
var htmlFiles embed.FS
+// remove '?' part and trailing '/'
+func cleanURL(url string) string {
+ url = "/" + strings.Trim(url, "/")
+ return url
+}
+
func okHandler(w http.ResponseWriter, r *http.Request) {
- // dumpClient(r)
+ dumpClient(r)
var tmp string
- tmp = r.URL.String()
+ // tmp = r.URL.String()
+ tmp = cleanURL(r.URL.Path)
parts := strings.Split(tmp, "?")
- log.Warn("client sent url =", tmp)
- log.Warn("parts are:", parts)
+ log.Info("client sent url =", tmp)
+ log.Info("parts are:", parts)
requrl := parts[0]
url, repourl := findkey(requrl)
- log.Warn("URL =", url, "REPO URL =", repourl, "REQUEST URL =", requrl)
+ log.Info("go.wit.com URL =", url, "REPO URL =", repourl, "REQUEST URL =", requrl)
if repourl != "" {
repoHTML(w, url, repourl)
return