harden runtime config and docs

This commit is contained in:
root
2026-06-27 20:58:07 +00:00
parent c148c1b36b
commit 991a0f62b4
13 changed files with 147 additions and 62 deletions
+2 -2
View File
@@ -8,9 +8,9 @@ session_name : the name of the session
>session
:content
Deletes the cookie specified by `session_name` and clears the data stored under the current session ID.
Deletes the cookie specified by `session_name`, removes the matching server-side session file, and clears the data stored under the current session ID.
This also empties `context.session_id` and `context.session`.
This also empties `context.session_id`, `context.session_name`, and `context.session`.
:example
+1 -1
View File
@@ -11,7 +11,7 @@ return value : the current session ID
:content
Starts a session or reconnects to an existing one.
If the cookie named by `session_name` does not exist, UCE creates it and fills it with a new unique session ID. The function then loads the session data for that ID.
If the cookie named by `session_name` does not exist, UCE creates it and fills it with a new unique session ID. The function then loads the session data for that ID. Session cookies are emitted with `Path=/`, `HttpOnly`, `SameSite=Lax`, and `Secure` when `SESSION_COOKIE_SECURE=1` is set in the runtime config.
After `session_start()` completes, the following `context` fields are populated:
+2 -2
View File
@@ -2,7 +2,7 @@
u64 socket_connect(String host, u16 port)
:params
host : host name
host : IPv4 address (for example `127.0.0.1`), as a dotted-quad string
port : port number
return value : the socket handle
@@ -12,7 +12,7 @@ return value : the socket handle
:content
Opens a socket connection to the given `host` and `port`.
The returned socket handle is then used with `socket_read()`, `socket_write()`, and `socket_close()`.
The returned socket handle is then used with `socket_read()`, `socket_write()`, and `socket_close()`. Currently this helper accepts IPv4 dotted-quad addresses in socket calls and does not perform hostname resolution.
:example
u64 fd = socket_connect("127.0.0.1", 80);
+3 -2
View File
@@ -17,8 +17,9 @@ RENDER(Request& context)
String action = first(context.get["action"], "touch");
String session_id = session_start("uce-site-tests");
String session_path = context.server->config["SESSION_PATH"] + "/" + session_id;
if(action == "destroy")
session_destroy();
session_destroy("uce-site-tests");
else
context.session["suite"] = "http";
@@ -56,7 +57,7 @@ RENDER(Request& context)
check("session_id_create()", generated_session.length() >= 16, generated_session);
if(action == "destroy")
check("session_destroy()", session_dump.find("suite") == String::npos, session_dump);
check("session_destroy()", session_dump.find("suite") == String::npos && context.session_id == "" && context.session_name == "" && !file_exists(session_path), session_dump + " path=" + session_path);
else
check("context.session writes", context.session["suite"] == "http", session_dump);