GmCapsule [main]

Updated docs

=> ce775ed35ada7fb59a42084955c3dd76be851df8

diff --git a/gmcapsule/__init__.py b/gmcapsule/__init__.py
index 96ec7d8..9586881 100644
--- a/gmcapsule/__init__.py
+++ b/gmcapsule/__init__.py
@@ -102,6 +102,14 @@ modules : path [path...]
 
 threads : int
     Number of worker threads. At least 1 is required. Defaults to 5.
+    Determines how many clients can be responded to at the same time.
+
+processes : int
+    Number of request handler processes. Defaults to 2. Request handler
+    processes run independently of the main process, allowing multiple
+    long-running requests to be handled concurrently. If zero, the worker
+    threads handle requests synchronously and are able to only do I/O
+    operations concurrently.
 
 
 titan
@@ -370,7 +378,8 @@ contextual information:
 - ``SERVER_NAME``
 - ``SERVER_PORT``
 - ``AUTH_TYPE``
-- ``REMOTE_IDENT`` (when client certificate provided)
+- ``TLS_CLIENT_HASH`` (when client certificate provided)
+- ``REMOTE_IDENT`` (fingerprints of client certificate and public key)
 - ``REMOTE_USER`` (when client certificate provided)
 - ``CONTENT_LENGTH`` (Titan only)
 - ``CONTENT_TYPE`` (Titan only)
@@ -413,6 +422,10 @@ That is, the name of the extension ("extmod") is prefixed with two numbers
 which modules are loaded. The ones loaded first have precedence over
 registered URL entry points.
 
+If the server has been configured to use multiple processes, each process
+loads the extensions separately. This may require synchronizing access to
+external resources accessed by extensions.
+
 
 Initialization
 --------------
@@ -447,12 +460,11 @@ to the client:
 - Returning a two-element tuple is interpreted as (status code, meta).
   The response body will be empty. This is useful for error messages and
   redirects.
-- Returning a three-element tuple is interpreted as (status code, meta,
-  body). If the body type is ``str``, it will be UTF-8 encoded before sending.
-  Otherwise, the body is sent as-is. If the body type isn't ``bytes`` or
-  ``bytearray``, it is assumed to be a buffered file-like object. In this
-  case, the entire body is not read in memory first, and ``close()`` will be
-  called on the object afterwards to release its resources.
+- Returning a three-element tuple is interpreted as (status, meta, body).
+  If the body type is ``str``, it will be UTF-8 encoded before sending.
+  If the body type is ``pathlib.Path``, the referenced file is opened and
+  its contents are streamed to the client without reading the entire file
+  to memory. Otherwise, the body type must be ``bytes`` or ``bytearray``.
 
 
 Future improvements
@@ -462,8 +474,6 @@ The following limitations could/should be lifted in the future:
 
 - Enable value interpolation in the `configparser`, allowing access to
   defined values and environment variables.
-- Add Titan configuration option to not require a client certificate.
-- Extension modules should be reloadable. Add a ``deinit()`` method.
 - `gitview` should have a URL path prefix.
 - Caches should be informed of identities and queries; content might still
   be cacheable.
diff --git a/gmcapsule/gemini.py b/gmcapsule/gemini.py
index 163871b..e80183e 100644
--- a/gmcapsule/gemini.py
+++ b/gmcapsule/gemini.py
@@ -616,8 +616,10 @@ class Context:
             request (Request): Request object.
 
         Returns:
-            Tuple with (status, meta, body, cache). The body can be bytes/bytearray or
-            an I/O object. The cache is None if the data was not read from a cache.
+            tuple: (status, meta, body, cache). The type of body can be bytes,
+            bytearray, or pathlib.Path. Returning a pathlib.Path means that
+            the body will be read from the referenced file. The cache is None
+            if the data was not read from a cache.
         """
         entrypoint = self.find_entrypoint(request.scheme, request.hostname, request.path)
 
Proxy Information
Original URL
gemini://git.skyjake.fi/gmcapsule/main/cdiff/ce775ed35ada7fb59a42084955c3dd76be851df8
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
62.028311 milliseconds
Gemini-to-HTML Time
0.246882 milliseconds

This content has been proxied by September (ba2dc).