support Connection: keep-alive; misc performance improvements

This commit is contained in:
2025-06-29 04:41:24 -07:00
parent 842719b102
commit cf43fef106
3 changed files with 46 additions and 28 deletions

View File

@ -45,15 +45,14 @@
(return (get @route-map route)))
(meth [lru-cache] get-route-by-path [path]
(meth get-route-by-path [path]
(cond
(in path @route-map) (do (get @route-map path))
True (do
(while (> (.count path "/") 1)
(setv path (.join "/" (get (.split path "/") (slice 0 -1))))
(when (in (+ path "/*") @route-map)
(setv handler (get @route-map (+ path "/*")))
(return handler)))
(return (get @route-map (+ path "/*")))))
(always (fn [#* _] (error 404 "not-found)")))))))