From e156fe7e15e236f11ffb8828273d4014db156d2f Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Mon, 21 Dec 2020 09:01:46 -0600 Subject: removed dep on parzival, introduced dep on hunchentoot hopefully the hunchentoot dep is temporary. I had to patch over my ill-conceived multipart form decoder. --- decoders.lisp | 84 ++++++++-------------------------------------------------- lazybones.asd | 4 +-- lazybones.lisp | 23 ++++++++++------ package.lisp | 2 +- 4 files changed, 29 insertions(+), 84 deletions(-) diff --git a/decoders.lisp b/decoders.lisp index c75a323..7f581a5 100644 --- a/decoders.lisp +++ b/decoders.lisp @@ -50,79 +50,17 @@ ;;; MULTIPART/FORM-DATA DECODER -(<" :license "AGPLv3" - :version "0.1.0" + :version "0.2.0" :serial t :depends-on (#:clack + #:hunchentoot ;; temporary #:jonathan #:alexandria #:split-sequence #:do-urlencode #:arrows - #:parzival #:uiop #:cl-fad) :components ((:file "package") diff --git a/lazybones.lisp b/lazybones.lisp index 855f2d1..2d4ca41 100644 --- a/lazybones.lisp +++ b/lazybones.lisp @@ -2,6 +2,8 @@ (in-package #:lazybones) +(clack.util:find-handler :hunchentoot) ;; temporary + ;;; SPECIAL VARS (defvar *handler* nil @@ -322,12 +324,12 @@ CURRENT-HANDLER, allowing for non-local exits via (RETURN-FROM CURRENT-HANDLER . (key (path-to-route-key method path)) (block-label (gensym "HANDLER")) (body-block `(block ,block-label - (flet ((http-ok (content-type &rest content) - (return-from ,block-label - (apply #'http-ok content-type content))) - (http-err (code text) - (return-from ,block-label - (funcall #'http-err code text)))) + (flet ((http-ok (content-type &rest content) + (return-from ,block-label + (apply #'http-ok content-type content))) + (http-err (code text) + (return-from ,block-label + (funcall #'http-err code text)))) ,@body)))) (if (member method '(:post :put :patch)) @@ -389,6 +391,9 @@ for the request's path." ;; otherwise (values nil nil))) +(defvar *debugging* nil + "Set to T to allow the main thread to drop into the debugger when + errors are encountered") (defun main-handler (*req*) (when *logging-p* @@ -399,13 +404,15 @@ for the request's path." (apply handler *req* args) (http-err 404 "Not Found"))) (error (e) - (print e *error-output* ) + (if *debugging* + (invoke-debugger e) + (print e *error-output* )) (http-err 500 "Internal Server Error")))) (defun start (&key (port 5000)) - (setf *handler* (clack:clackup #'main-handler :port port))) + (setf *handler* (clack:clackup 'main-handler :port port))) (defun stop () (when *handler* diff --git a/package.lisp b/package.lisp index 3cefcea..045a5be 100644 --- a/package.lisp +++ b/package.lisp @@ -33,7 +33,7 @@ )) (defpackage #:lazybones.decoders - (:use #:cl #:parzival) + (:use #:cl) (:import-from #:split-sequence #:split-sequence) (:import-from #:arrows -- cgit v1.2.3