CL-HTTP Appendix A: Quick Reference


Reference Manual | Prev: Chapter 19. Extending CL-HTTP | Next: Appendix B. Condition Hierarchy


This appendix provides a concise categorized reference to the most commonly used functions and macros in CL-HTTP. For full documentation of any symbol, use the online documentation facility at /cl-http/find-documentation.html.

Serving Content

Function/Macro Package Description
export-url HTTP Export a URL with a specified translation type, making it accessible to clients. Takes a URL string and an export type keyword (e.g., :html-file, :computed, :html-form), plus keyword arguments specific to the export type.
with-successful-response HTTP Wrap around response function code. Sends the 200 status code and appropriate headers, then executes the body which writes the response content. Takes the stream, content-type, and optional keyword arguments for entity-tag, expires, cache-control, content-location, content-language, and additional-headers.
with-conditional-get-response HTTP Like with-successful-response but supports conditional GET. Returns 304 Not Modified when the client already has the current version, avoiding unnecessary data transfer. Takes a last-modification time and optional entity-tag for cache validation.

HTML Document Structure

Function/Macro Package Description
with-html-document HTML Establish the top-level HTML document environment. Emits <html> and </html> tags. Accepts :declare-dtd-version-p to emit a DOCTYPE declaration, :language, :direction, and :stream.
with-document-preamble HTML Establish the HTML document head (<head>). Used within with-html-document for title, meta info, stylesheets, and scripts.
with-document-body HTML Establish the HTML document body (<body>). Accepts standard attributes: :class, :id, :style, :language, :direction, :events.
declare-title HTML Emit a <title> element within the document preamble. Takes a title string and optional :language and :direction arguments.

HTML Text Elements

Function/Macro Package Description
with-section-heading HTML Emit a section heading (<h1> through <h6>). Takes the heading text and :level (defaults to *section-level*). The body executes within the heading element.
with-paragraph HTML Emit a paragraph (<p>) element around the body. Accepts standard attributes including :class, :id, :style, :language, :direction, :events.
with-rendition HTML Emit inline text rendition around the body. The rendition argument is a keyword: :bold, :italic, :underline, :strike, :code, :teletype, :superscript, :subscript, :emphasis, :strong, :citation, :keyboard, :variable, :sample.
break-line HTML Emit a line break (<br>). Accepts optional :clear, :class, :id, :style.
horizontal-line HTML Emit a horizontal rule (<hr>). Accepts :class, :id, :style, :language, :direction, :events, :fresh-line.

HTML Links and Media

Function/Macro Package Description
with-anchor-noted HTML Emit an anchor (<a>) element around the body. Takes :reference (the URL), :local-reference (fragment), :tag (name anchor), :relation, :inverse, :target.
image HTML Emit an <img> element. Takes the image URL and alternative text as required arguments. Optional: :alignment, :accept-coordinates-at-url, :border, :height, :width, :class, :id, :events.
note-anchor HTML Emit a complete anchor with text. Unlike with-anchor-noted, this is a function call rather than a macro wrapping a body. Takes text and :reference, :local-reference, :tag, :relation, :inverse, :target.

HTML Lists

Function/Macro Package Description
with-enumeration HTML Establish a list environment. Takes the stream and an enumeration style: :itemize (<ul>), :enumerate (<ol>), :definition (<dl>), :directory, :menu, :plain. Optional: :compact, :type, :start.
enumerating-item HTML Emit a list item (<li>) within an enumeration. Takes the stream and optional :icon-url, :head (for definition lists), :type.

HTML Tables

Function/Macro Package Description
with-table HTML Establish a table environment (<table>). Accepts :width, :border, :cell-spacing, :cell-padding, :frame, :rules, :summary, :alignment, :background.
with-table-row HTML Emit a table row (<tr>). Accepts :horizontal-alignment, :vertical-alignment, and standard attributes.
with-table-cell HTML Emit a table cell (<td> or <th>). :header-p controls whether to emit <th>. Accepts :column-span, :row-span, :horizontal-alignment, :vertical-alignment.

HTML Forms

Function/Macro Package Description
with-fillout-form HTML Establish a form environment (<form>). Takes the action (HTTP method, e.g., :post or :get) and destination URL. Optional: :encoding-type, :name, :target, :events.
accept-input HTML Emit a form input element. Takes an input type and query name. Input types include: string, multi-line-text, radio-button, checkbox, select-choices, hidden, file, image, submit-button, reset-button, client-side-button, password, and HTML5 types: email, url-field, number-field, range-field, date-field, color-field, search-field, tel, time-field.
bind-query-values HTTP Bind form values from a POST query-alist to local variables. Used in response functions for :html-form and :html-computed-form export types.

URL Operations

Function/Macro Package Description
intern-url URL Intern a URL string, returning the URL object. Creates the URL object if it does not already exist. The URL is interned in the URL table and associated with the appropriate URL class based on its scheme.
name-string URL Return the canonical string representation of a URL object.
search-keys URL Return the parsed search keys from a search URL. The search suffix following the "?" is parsed and returned as a list of strings.
translated-pathname URL Return the pathname associated with a URL via export-url. For static file export types, this is the file to serve.

Server Control

Function/Macro Package Description
enable-http-service HTTP Start accepting HTTP connections. Takes :on-ports to specify which ports to listen on (defaults to port 80).
disable-http-service HTTP Stop accepting HTTP connections. Drains the process pool and closes all active listeners.
ensure-http-protocol-on-port HTTP Ensure an HTTP service is listening on a specific port. Creates the service if it does not already exist.

Authentication

Function/Macro Package Description
define-realm HTTP Define an authentication realm with a specified scheme (e.g., :basic, :digest).
add-user HTTP Add a user to an authentication realm with a username and password.
add-group HTTP Add a group to an authentication realm and associate users with it. Groups can be used in access control specifications for exported URLs.

HTTP Client

Function/Macro Package Description
get-url HTTP Perform an HTTP GET request to a URL. Returns the response headers and body. Supports SSL/TLS and HTTP/2 ALPN negotiation.
post-url HTTP Perform an HTTP POST request to a URL with form data or a body. Returns the response headers and body.

Logging

Function/Macro Package Description
logging-on HTTP Enable logging for HTTP transactions. CL-HTTP supports multiple log formats including Common Log Format, extended logging, and notification logging.
logging-off HTTP Disable HTTP transaction logging.