summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorMarin Ivanov <[email protected]>2025-06-22 17:49:32 +0300
committerMarin Ivanov <[email protected]>2025-06-22 17:49:32 +0300
commit9608d6c132df1accbd67d8e04657928d2018c3ca (patch)
treec7401fbd109466c753de7eafcb48728f1f477947 /main.go
parent053c60c3a23b76d2014a35d02c7a8fc32908b55c (diff)
add text/x-url handing as redirect.
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/main.go b/main.go
index 6aa5c8a..8c02dd3 100644
--- a/main.go
+++ b/main.go
@@ -178,6 +178,16 @@ func (s *Server) servePosting(w http.ResponseWriter, r *http.Request, name strin
case "text/x-ansi":
serveAnsiHtml(w, filename)
return
+ case "text/x-url":
+ location, err := os.ReadFile(filename)
+ if err != nil {
+ log.Print("read(): ", err)
+ w.WriteHeader(http.StatusNotFound)
+ return
+ }
+ w.Header().Add("location", string(location))
+ w.WriteHeader(http.StatusFound)
+ return
case "":
m.ContentType = "application/octet-stream"
default: