via

Simple pubsub server inspired by https://patchbay.pub/
git clone https://git.ce9e.org/via.git

commit
d55570c2d4468d6087d1bf4cef61512d3f7a94ca
parent
73dd9964daf5d5bf4d8f4869c50fdcdc280b68d0
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2025-06-13 14:43
perf: exit early on bad PUT requests

Diffstat

M via.go 6 +++---

1 files changed, 3 insertions, 3 deletions


diff --git a/via.go b/via.go

@@ -260,9 +260,6 @@ func put(w http.ResponseWriter, r *http.Request) {
  260   260 		return
  261   261 	}
  262   262 
  263    -1 	topic := getTopic(r.URL.Path)
  264    -1 	defer topic.cleanup(r.URL.Path)
  265    -1 
  266   263 	lastId, err := strconv.Atoi(r.Header.Get("Last-Event-ID"))
  267   264 	if err != nil {
  268   265 		http.Error(w, "Missing Last-Event-ID", http.StatusBadRequest)
@@ -276,6 +273,9 @@ func put(w http.ResponseWriter, r *http.Request) {
  276   273 		return
  277   274 	}
  278   275 
   -1   276 	topic := getTopic(r.URL.Path)
   -1   277 	defer topic.cleanup(r.URL.Path)
   -1   278 
  279   279 	topic.Lock()
  280   280 	defer topic.Unlock()
  281   281