Home /Modules/web-server-technology/README.md

README.md

lib/web-server-technology/README.md · 112 line(s) · markdown

lib/web-server-technology — SLeeLa facade for the dynamic SQL web server

This package is the SLeeLa-side model of the dynamic, SQL-backed HTTP/1.1 server whose native implementation lives in web-server-technology/native. The facade classes describe the server's configuration, the dynamic /db endpoint policy, and the world-reachable dual-stack binding; they do not open sockets themselves — the native server does that.

Classes

ClassRole
SLPackagepackage manifest (executive-tier metadata record)
SLWebServerserver configuration + lifecycle (configure/open/shutdownServer/active), document root, port, threads, bind address, and the /db enable + writable flags
SLSqlEndpointthe dynamic /db route policy: route prefix, read-only vs writable, statement/row bounds, and read-verb classification that mirrors the native statement_is_readonly logic
SLDualStackBindingthe binding descriptor; reachesWorld() is true only when bound to all interfaces as dual-stack IPv6+IPv4
SLWebProgramSide 2: a mounted program whose backing kind is static, sql, or meme (named SLWebProgram to avoid colliding with lib/cpu/SLProgram)
SLWarrantSide 2: a cause served for a subject by a program; matchesHost models the host/enabled gate
SLEnvelopmentSide 2: a domain that envelops many programs; active() enforces the Scientist gate (turnOn() + grantScientist() + at least one warrant)

Validate

Library classes have no main(), so validate through the sibling demo (which sleela run auto-links against every .sleela in this directory):

export SLEELA_SHA256_MANIFEST="$PWD/security/sha256-manifest.json"   # from repo root
impl/build/sleela check lib/web-server-technology/demo-web-server-technology.sleela
impl/build/sleela run   lib/web-server-technology/demo-web-server-technology.sleela

The demo asserts the policy correspondence with the native server: SELECT is permitted read-only, INSERT is denied until writes are allowed, and a single-literal bind drops world reach.

Native C and C++ library (adjacent set)

Alongside the SLeeLa facade classes, this package ships a reusable native library of the same model — the dependency-free decision/model layer the standalone server builds on — in both C and C++, mirroring the lib/sleela-sql layout:

lib/web-server-technology/
  native/include/slweb.h      C11 public ABI
  native/src/slweb.c          C11 core implementation
  cpp/include/slweb.hpp       C++17 RAII facade over the same ABI
  cpp/src/slweb.cpp           facade translation unit
  tests/test_c.c              C smoke tests
  tests/test_cpp.cpp          C++ smoke tests
  Makefile                    builds libslweb.a, libslweb++.a; `make test`

It covers the whole subsystem model with no sockets and no HTTP wire handling:

Build and test

cd lib/web-server-technology
make        # -> build/libslweb.a and build/libslweb++.a
make test   # C and C++ smoke tests

Portability

The library is dependency-free (no sockets, no HTTP): it builds on Linux, macOS (Intel + Apple Silicon), and Windows 7–11 with a C++17 toolchain (MSVC 2017+ or MinGW-w64). The one platform-specific call is the CPU count (GetSystemInfo on Windows, sysconf on POSIX/macOS). Windows XP can build the C core but not the C++17 facade. See PORTABILITY.md for the full matrix and the honest verification status.

Consumers of the C++ facade link both the C++ and C core libraries (as with lib/sleela-sql). Example:

slweb_envelopment *e = slweb_env_new("science.example");
slweb_env_add_program(e, "lab", SLWEB_PROGRAM_SQL, "/lab", "./db", 0);
slweb_env_add_warrant(e, "expose", "science.example", "/lab", "lab", 1);
slweb_env_set_enabled(e, 1); slweb_env_set_scientist(e, 1);
char prog[SLWEB_MAX_NAME], cause[SLWEB_MAX_PATH]; slweb_program_kind k;
slweb_env_resolve(e, "science.example", "/lab/db/query", prog, cause, &k);
sleela::web::Envelopment env("science.example");
env.add_program("lab", sleela::web::ProgramKind::Sql, "/lab", "./db");
env.add_warrant("expose", "science.example", "/lab", "lab");
env.set_enabled(true); env.set_scientist(true);
if (auto r = env.resolve("science.example", "/lab/db/query"))
    /* r->program == "lab", r->kind == ProgramKind::Sql */;

Metadata

Every class carries the Descriptive-metadata block required by .kiro/steering/metadata-class-standard.md. The package and facade classes are executive-tier and cite real governing instruments in metaNationalSchedule (RFC 9112 for HTTP/1.1 framing, RFC 8259 for JSON, RFC 4291 for IPv6 addressing).