The hunchentools Reference Manual

This is the hunchentools Reference Manual, version 1.0.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 06:25:31 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 hunchentools

Hunchentoot utility library

Author

Michael J. Forster <>

License

MIT

Version

1.0.0

Dependencies
  • hunchentoot (system).
  • alexandria (system).
  • cl-ppcre (system).
  • ironclad (system).
Source

hunchentools.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 hunchentools/hunchentools.asd

Source

hunchentools.asd.

Parent Component

hunchentools (system).

ASDF Systems

hunchentools.


3.1.2 hunchentools/package.lisp

Source

hunchentools.asd.

Parent Component

hunchentools (system).

Packages

hunchentools.


3.1.3 hunchentools/abort.lisp

Dependency

package.lisp (file).

Source

hunchentools.asd.

Parent Component

hunchentools (system).

Public Interface

3.1.4 hunchentools/dispatcher.lisp

Dependency

package.lisp (file).

Source

hunchentools.asd.

Parent Component

hunchentools (system).

Public Interface

3.1.5 hunchentools/string-escaping.lisp

Dependency

package.lisp (file).

Source

hunchentools.asd.

Parent Component

hunchentools (system).

Public Interface

3.1.6 hunchentools/session-cookie.lisp

Dependency

package.lisp (file).

Source

hunchentools.asd.

Parent Component

hunchentools (system).

Public Interface

harden-session-cookie (function).


3.1.7 hunchentools/session-user.lisp

Dependency

package.lisp (file).

Source

hunchentools.asd.

Parent Component

hunchentools (system).

Public Interface

3.1.8 hunchentools/session-csrf-token.lisp

Dependency

package.lisp (file).

Source

hunchentools.asd.

Parent Component

hunchentools (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 hunchentools

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Ordinary functions

Function: abort-with-bad-request ()

Abort handling of the request as if the handler had returned HUNCHENTOOT:+HTTP-BAD-REQUEST+.

Package

hunchentools.

Source

abort.lisp.

Function: abort-with-forbidden ()

Abort handling of the request as if the handler had returned HUNCHENTOOT:+HTTP-FORBIDDEN+.

Package

hunchentools.

Source

abort.lisp.

Function: abort-with-internal-server-error ()

Abort handling of the request as if the handler had returned HUNCHENTOOT:+HTTP-INTERNAL-SERVER-ERROR+.

Package

hunchentools.

Source

abort.lisp.

Function: abort-with-not-found ()

Abort handling of the request as if the handler had returned HUNCHENTOOT:+HTTP-NOT-FOUND+.

Package

hunchentools.

Source

abort.lisp.

Function: abort-with-return-code (return-code)

Abort handling of the request as if the handler had returned RETURN-CODE.

Package

hunchentools.

Source

abort.lisp.

Function: create-prefix-methods-dispatcher (prefix methods handler)

Return a request dispatch function which will dispatch to the function denoted by HANDLER if the file name of the current request starts with the string PREFIX and the method of the current request is a member of the list denoted by METHODS. The dispatch function will return NIL if there is no match.

Package

hunchentools.

Source

dispatcher.lisp.

Function: create-regex-methods-dispatcher (regex methods handler)

Return a request dispatch function which will dispatch to the function denoted by HANDLER if the file name of the current request matches the CL-PPCRE regular expression REGEX and the method of the current request is a member of the list denoted by METHODS. The dispatch function will return NIL if there is no match.

Package

hunchentools.

Source

dispatcher.lisp.

Function: create-uri-methods-dispatcher (uri methods handler)

Return a request dispatch function which will dispatch to the function denoted by HANDLER if the file name of the current request matches the string URI and the method of the current request is a member of the list denoted by METHODS. The dispatch function will return NIL if there is no match.

Package

hunchentools.

Source

dispatcher.lisp.

Function: delete-session-csrf-token ()

Remove the CSRF token, if any, from the session.

Package

hunchentools.

Source

session-csrf-token.lisp.

Function: delete-session-user ()

Remove the user, if any, from the session.

Package

hunchentools.

Source

session-user.lisp.

Function: escape-string-custom (string test escape-write-function)

Given a string STRING, return a new string, encoding with the
function denoted by ESCAPE-WRITE-FUNCTION every character for which the function denoted by TEST returns true.

Use this in place of CL-WHO:ESCAPE-STRING where custom encoding is required.

Package

hunchentools.

Source

string-escaping.lisp.

Function: escape-string-js (string)

Given a string STRING, return a new string, escaping all ASCII values less than 256 with the xHH format and those greater than or equal to 256 with the uHHHH format.

Package

hunchentools.

Source

string-escaping.lisp.

Function: harden-session-cookie (&key securep name)

Set the HTTP-ONLY and secure flags of the outgoing cookie named NAME and set it to expire with the session. NAME defaults to "hunchentoot-session".

Package

hunchentools.

Source

session-cookie.lisp.

Function: require-session-csrf-token (request-type &optional name)

Abort handling the request, log a warning message, and remove any session CSRF token if the request of type denoted by REQUEST-TYPE does not provide a value for the parameter NAME, if the provided value does not match the session CSRF token, or if the session CSRF token has not been set. Othewise, do nothing. REQUEST-TYPE can be one
of :GET, :POST, :PUT, or :DELETE. NAME defaults to "csrf-token".

Package

hunchentools.

Source

session-csrf-token.lisp.

Function: require-session-user (&rest redirect-args)

Log a warning message and redirect if no user is set for the session. Otherwise, do nothing. REDIRECT-ARGS are used as keyword arguments to HUNCHENTOOT:REDIRECT.

Package

hunchentools.

Source

session-user.lisp.

Function: session-csrf-token ()

Return the current CSRF token set for the session or a new token if one has not been set. If the session does not exist, return NIL.

Package

hunchentools.

Source

session-csrf-token.lisp.

Function: session-user ()

Return the user set for the session. Return NIL if the session does not exist or if no user has been set.

SETF of SESSION-USER can be used to set a new user for the session. If the session does not exist then one is created. Signal a correctable error of type TYPE-ERROR if SETF of SESSION-USER is called with a NIL value for user.

Package

hunchentools.

Source

session-user.lisp.

Function: (setf session-user) ()
Package

hunchentools.

Source

session-user.lisp.


5.2 Internals


5.2.1 Special variables

Special Variable: *csrf-secret*
Package

hunchentools.

Source

session-csrf-token.lisp.

Special Variable: *the-random-state*
Package

hunchentools.

Source

session-csrf-token.lisp.


5.2.2 Ordinary functions

Function: next-csrf-token ()
Package

hunchentools.

Source

session-csrf-token.lisp.

Function: random-string (&optional n base)

Return a random number (as a string) with base BASE and N digits.

Package

hunchentools.

Source

session-csrf-token.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
A   C   D   E   F   H   N   R   S  
Index Entry  Section

(
(setf session-user): Public ordinary functions

A
abort-with-bad-request: Public ordinary functions
abort-with-forbidden: Public ordinary functions
abort-with-internal-server-error: Public ordinary functions
abort-with-not-found: Public ordinary functions
abort-with-return-code: Public ordinary functions

C
create-prefix-methods-dispatcher: Public ordinary functions
create-regex-methods-dispatcher: Public ordinary functions
create-uri-methods-dispatcher: Public ordinary functions

D
delete-session-csrf-token: Public ordinary functions
delete-session-user: Public ordinary functions

E
escape-string-custom: Public ordinary functions
escape-string-js: Public ordinary functions

F
Function, (setf session-user): Public ordinary functions
Function, abort-with-bad-request: Public ordinary functions
Function, abort-with-forbidden: Public ordinary functions
Function, abort-with-internal-server-error: Public ordinary functions
Function, abort-with-not-found: Public ordinary functions
Function, abort-with-return-code: Public ordinary functions
Function, create-prefix-methods-dispatcher: Public ordinary functions
Function, create-regex-methods-dispatcher: Public ordinary functions
Function, create-uri-methods-dispatcher: Public ordinary functions
Function, delete-session-csrf-token: Public ordinary functions
Function, delete-session-user: Public ordinary functions
Function, escape-string-custom: Public ordinary functions
Function, escape-string-js: Public ordinary functions
Function, harden-session-cookie: Public ordinary functions
Function, next-csrf-token: Private ordinary functions
Function, random-string: Private ordinary functions
Function, require-session-csrf-token: Public ordinary functions
Function, require-session-user: Public ordinary functions
Function, session-csrf-token: Public ordinary functions
Function, session-user: Public ordinary functions

H
harden-session-cookie: Public ordinary functions

N
next-csrf-token: Private ordinary functions

R
random-string: Private ordinary functions
require-session-csrf-token: Public ordinary functions
require-session-user: Public ordinary functions

S
session-csrf-token: Public ordinary functions
session-user: Public ordinary functions