aboutsummaryrefslogtreecommitdiff
path: root/src/protocol.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol.lisp')
-rw-r--r--src/protocol.lisp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/protocol.lisp b/src/protocol.lisp
index f94364a..74019b1 100644
--- a/src/protocol.lisp
+++ b/src/protocol.lisp
@@ -101,6 +101,17 @@ that the request has insufficient permissions to evoke the endpoint handler. "))
;;; HANDLER PROTOCOL
+(defgeneric check-request-compliance (endpoint-instance-class)
+ (:documentation "This function is called before instances the endpoint class are
+created; This occurrs before the HTTP request's body has been
+read. All request headers are available for inspection.
+
+This is meant to enforce higher-level or server-wide policies, such as
+on the size of request bodies.")
+ (:method ((epclass symbol))
+ (check-request-compliance (find-class epclass)))
+ (:method ((epclass t))))
+
(defgeneric authenticate (endpoint)
(:documentation "Returns a boolean. Any protected endpoint should implement
this. Called before handling, should be used to supply
@@ -161,6 +172,11 @@ AUTHORIZE while handling endpoint-class instance EP."
"Returns the cookie with name NAME the actively"
(http:cookie-in name))
+(defun get-header (name)
+ "Returns the string value of the header named NAME, which can be a
+string or keyword."
+ (http:header-in* name))
+
(define-condition request-error (error)
((content :reader error-content :initarg :content :initform "Bad Request")
(mimetype :reader error-content-mimetype :initarg :mimetype :initform "text/plain")