Home/Modules/http-1.0

http-1.0

system module http-1.0

<img align="right" src="https://github.com/mearvk/SLeeLa/blob/master/images/debian/debian-logo.png" width="75" height="75" alt="SLeeLa">

<img src="https://github.com/mearvk/SLeeLa/blob/master/images/sleela/sleela-logo-004.jpg" alt="SLeeLa">

SLeeLa HTTP 1.0

Status: Internet-capable SLeeLa application-protocol server.

Platforms: Linux · macOS · Windows 10+

SLeeLa HTTP 1.0 establishes the baseline application model used by the later HTTP generations in this repository. It keeps transport addressing separate from SLeeLa's logical service-routing identifiers and provides a portable, real-wire HTTP/1.0 server built on the sleela_net socket abstraction.

Build and test

make            # build the http1_server binary + negotiation objects
make test       # run the built-in self-test (parse, negotiation, download state)
make syntax     # syntax-only check of all sources
make clean      # remove build artefacts

Platform notes

PlatformSocket layerCompilerLink flags
LinuxPOSIX sockets via sleela_netcc / gcc(none)
macOSPOSIX sockets via sleela_netcc / clang(none)
Windows 10+Winsock2 via sleela_netMSVC / MinGW-lws2_32

The Makefile detects Windows via $(OS) and adds -lws2_32 automatically.

Running the server

./http1_server --port 8080

Options:

The server logs to stderr and runs until interrupted (SIGINT / SIGTERM on POSIX; Ctrl-C on Windows).

Architecture

Native transport endpoint (TCP, any platform)
        |
HTTP/1.0 request / connection       ← sleela_net portable sockets
        |
SLeeLa envelope / route             ← X-SLeeLa-* application headers
        |
Logical PORT (X-SLeeLa-Port)
        |
SERVICE-ID (X-SLeeLa-Service-ID)
        |
OP-ID (X-SLeeLa-Op-ID)
        |
Application handler
        |
HTTP/1.0 response

A SLeeLa logical port is an application-level identifier. It is not a replacement for, or necessarily a one-to-one mapping with, a native TCP or UDP port.

SLeeLa application headers

Every response includes the version advertisement headers described in HTTP.NEGOTIATION.md:

X-SLeeLa-Version: 1.0
X-SLeeLa-Accept: 1.0, 1.1

Clients may set the following request headers for SLeeLa logical routing:

HeaderPurpose
X-SLeeLa-VersionRequested SLeeLa protocol generation
X-SLeeLa-AcceptComma-separated acceptable generations
X-SLeeLa-PortLogical port (application route)
X-SLeeLa-Service-IDService identifier
X-SLeeLa-Op-IDOperation identifier

A normal HTTP/1.x peer may ignore these headers and continue ordinary request/response processing (HTTP.NEGOTIATION.md §Wire fallback).

Built-in endpoints

PathMethodDescription
/__sleela/healthGETReturns SLeeLa HTTP/1.0 OK
/__sleela/statusGETJSON: server, generation, VM, platform
/__sleela/negotiateGETVersion negotiation result (JSON)

Multiplexing

HTTP/1.0 does not provide HTTP/2-style stream multiplexing. SLeeLa therefore treats concurrent application exchanges as logical operations above the HTTP/1.0 request and connection boundary, using one-request-per-connection.

Large-file download mode

SLeeLa HTTP 1.0 and later generations define a common DOWNLOAD mode for files larger than 50 MB. The server provides resume metadata:

SESSION-ID | DATETIME | FILE-ID | FILE-NAME | INDEX | OFFSET | TOTAL-SIZE

The 50 MB threshold selects the resume-oriented mode; it is not a maximum file size.

Compatibility

The HTTP 1.0 layer is designed to coexist with conventional HTTP infrastructure. TCP sockets, TLS termination, proxies, routers, and native port bindings remain transport concerns; SLeeLa logical ports remain application-routing concerns.

Policy hooks

The server checks two policy gates on startup and per-negotiation:

  1. Preferred router (preferred_router) — verifies routing-tier policy.
  2. Resolver (resolver) — verifies event/packet policy.

Both are opt-in; the server continues with built-in defaults when the external configuration is unavailable.

File inventory

FileDescription
http1_server.hServer API, request/response types, download state
http1_server.cFull server: parse, route, respond, self-test
http1_main.cCLI entry point (demo handler)
http_negotiation.hC negotiation API
http_negotiation.cVersion negotiation with policy checks
http_negotiation.hppC++ negotiation wrapper
http_negotiation.cppC++ wrapper implementation
MakefileBuild: all, server, syntax, test, clean
FLOW.mdRequest-path diagram and multiplexing design
HTTP.NEGOTIATION.mdNegotiation protocol for SLeeLa HTTP 1–9
STATUS.mdPort multiplexing and download-mode status

Dependencies

ModulePathRole
sleela_netimpl/core/sleela_net.{c,h}Portable TCP sockets
preferred_routerpreferred-routers/Routing-tier policy
resolverresolver/DNS / path / event policy

Scope

HTTP 1.0 provides the foundational routing and transfer model. Later SLeeLa generations add additional framing, multiplexing, integrity, capability, and application features without changing the distinction between transport and application addressing.

Unified route data

This server consumes the SLeeLa unified route-data contract in route/ROUTE.DATA.json and route/ROUTE.DATA.md. Route records carry protocol, server surface, HTTP generation, VM generation/formal VM name, canonical configuration root, route identifier, target/resolution mode, capability, transport, port, and status. VM names are architectural metadata only and do not grant capabilities. Dynamic targets must use the shared resolver before acceptance.

Security and validation

The native parser applies bounded header/body sizes, validates request-line and header token syntax, rejects control characters, duplicate header fields, duplicate or malformed Content-Length, and unsupported Transfer-Encoding. It requires complete request bodies and applies a 10-second total deadline to header and body reads. Response headers are validated and bounded before serialization. Resumable-download metadata rejects malformed decimal fields, offsets beyond the file size, delimiters/control characters, and path-like file names.

Run the expanded checks with:

The current portable listener binds all interfaces; the bind_address config field is reserved and is not yet enforced by sleela_net. Use host firewall rules and a trusted TLS-terminating proxy until address-specific binding is implemented.

The server remains serial (one connection at a time), and this code does not implement TLS or identity verification. Applications can configure the optional native authorize callback: return 0 to allow a request and non-zero to deny it. When configured, it protects all routes except GET/HEAD /__sleela/health. Do not expose plaintext HTTP to untrusted networks without a trusted TLS-terminating proxy. Protect non-health routes at the application layer, never treat X-SLeeLa routing IDs or download session IDs as credentials, and bind resume state to an authenticated principal and stable file identity. The declarative classes under lib/http-1.0 document these contracts; they do not replace native enforcement.


SLeeLa

<p align="center"><img src="images/sleela/sleela-wordmark.svg" alt="SLeeLa — The Now. The Ingredient." width="560"></p> <p align="center"><img src="https://github.com/mearvk/SLeeLa/blob/master/images/sleela-programming-language-002.jpg" alt="SLeeLa Marketing Logo" width="560"></p>

Files 12