From 369a0f769ac2261540840ffb19ed5ae139445096 Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau Date: Sat, 16 Aug 2025 12:25:32 +0200 Subject: [PATCH] Fix for latest Gerbil v0.18.1-163-ge55e0806 --- ftw/httpd/endpoint-test.ss | 4 ++-- ftw/httpd/endpoint.org | 7 ++++--- ftw/httpd/endpoint/struct.ss | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ftw/httpd/endpoint-test.ss b/ftw/httpd/endpoint-test.ss index efef9fd..dd8ffed 100644 --- a/ftw/httpd/endpoint-test.ss +++ b/ftw/httpd/endpoint-test.ss @@ -53,7 +53,7 @@ (default-handler req res)) (catch (e) (http-response-write res 500 '(("Content-Type" . "text/plain")) - (with-output-to-string (cut display-exception e)))))) + (with-output-to-string "" (cut display-exception e)))))) (def eq (endpoint-queue)) (def (test-endpoint-queue-handler req res) @@ -62,7 +62,7 @@ (default-handler req res)) (catch (e) (http-response-write res 500 '(("Content-Type" . "text/plain")) - (with-output-to-string (cut display-exception e)))))) + (with-output-to-string "" (cut display-exception e)))))) (def (testq/GET num arg) (http-response-write* 200 '(("Content-Type" . "text/plain")) diff --git a/ftw/httpd/endpoint.org b/ftw/httpd/endpoint.org index 7026f8d..17beac7 100644 --- a/ftw/httpd/endpoint.org +++ b/ftw/httpd/endpoint.org @@ -620,7 +620,7 @@ dispatcher function attached which returns a true value if successful. (default-handler req res)) (catch (e) (http-response-write res 500 '(("Content-Type" . "text/plain")) - (with-output-to-string (cut display-exception e)))))) + (with-output-to-string "" (cut display-exception e)))))) (def (testq/GET num arg) (http-response-write* 200 '(("Content-Type" . "text/plain")) @@ -773,7 +773,8 @@ request. #+begin_src gerbil (defmethod {endpoint-match-predicate endpoint} - (lambda (self (m (endpoint-match self))) + (lambda (self (m #f)) + (unless m (set! m (endpoint-match self))) (cond ((string? m) (endpoint-pregexp-match-predicate self)) ((procedure? m) m) (#t (error "Endpoint Match is not a string or a procedure"))))) @@ -882,7 +883,7 @@ Now a simple handler to register with the existing mux. (default-handler req res)) (catch (e) (http-response-write res 500 '(("Content-Type" . "text/plain")) - (with-output-to-string (cut display-exception e)))))) + (with-output-to-string "" (cut display-exception e)))))) #+end_src Let's make sure it works! diff --git a/ftw/httpd/endpoint/struct.ss b/ftw/httpd/endpoint/struct.ss index 1cf22f3..36c6004 100644 --- a/ftw/httpd/endpoint/struct.ss +++ b/ftw/httpd/endpoint/struct.ss @@ -22,7 +22,8 @@ (let ((groups (pregexp-match (endpoint-match endpoint) path))) (and groups (cdr groups))))) (defmethod {endpoint-match-predicate endpoint} - (lambda (self (m (endpoint-match self))) + (lambda (self (m #f)) + (unless m (set! m (endpoint-match self))) (cond ((string? m) (endpoint-pregexp-match-predicate self)) ((procedure? m) m) (#t (error "Endpoint Match is not a string or a procedure")))))