http3_server

Generated by tinox doc

tinox.core.http3_server, split out of the bundled stdlib as a standalone tinox-central package.

ModuleVersionGroup
http_server1.1.0tinox.core

Hello server

// HTTP/3 is opt-in at build time: compile with TINOX_HTTP3=1 tinox build ...
// (without it, http3ServerCreate is unavailable and linking fails).
import tinox.core.http3_server

class Main
{
    fnc main() -> Int32
    {
        const server: Http3Server = Http3Server::new(8443, "cert.pem", "key.pem")
        server.get("/hello", ctx => {
            ctx.response.text("Hello over HTTP/3!")
        })
        server.listen()
        return 0
    }
}

fn http3ServerCreate(port: Int64, certPath: String, keyPath: String, requireRetry: Bool, earlyDataEnabled: Bool, maxEarlyDataSize: Int64) → Int64

fn http3ServerPumpOnce(serverHandle: Int64) → Int64

fn http3RequestMethod(requestId: Int64) → String

fn http3RequestPath(requestId: Int64) → String

fn http3RequestHeaders(requestId: Int64) → Map<String, String>

fn http3RequestBody(requestId: Int64) → String

fn http3RequestWasEarlyData(requestId: Int64) → Bool

fn http3SubmitResponse(requestId: Int64, statusCode: Int64, headers: Map<String, String>, body: String) → Nothing

fn http3ReleaseRequest(requestId: Int64) → Nothing

fn http3ServerClose(serverHandle: Int64) → Nothing

class Http3Server

Fields

portInt64
certPathString
keyPathString
routesList<Route>
middlewareList<fnc(HttpContext) -> Bool>
serverHandleInt64
runningBool
requireRetryBool
earlyDataEnabledBool
maxEarlyDataSizeInt64

Methods

fn new(port: Int64, certPath: String, keyPath: String) → Http3Server
fn get(path: String, handler: fnc(HttpContext) -> Nothing) → Http3Server
fn post(path: String, handler: fnc(HttpContext) -> Nothing) → Http3Server
fn put(path: String, handler: fnc(HttpContext) -> Nothing) → Http3Server
fn patch(path: String, handler: fnc(HttpContext) -> Nothing) → Http3Server
fn delete(path: String, handler: fnc(HttpContext) -> Nothing) → Http3Server
fn use(mware: fnc(HttpContext) -> Bool) → Http3Server
fn requireAddressValidation(v: Bool) → Http3Server
fn enableEarlyData(maxSize: Int64) → Http3Server
fn stop() → Nothing
fn listen() → Nothing
* Binds the UDP socket, completes TLS/QUIC setup, and enters the * pump loop. Each http3ServerPumpOnce() call performs one unit of * native work (drain ready datagrams, service ngtcp2 timer * expiries, drive the nghttp3<->ngtcp2 write pump) and returns a * requestId once some stream's HTTP/3 request has fully arrived, * -1 if there was nothing to dispatch this tick, or -2 on a fatal * socket error.
fn dispatchRequest(requestId: Int64) → Nothing
* Builds an HttpRequest/HttpContext from the C-side request slot, * runs middleware + route matching (identical to HttpServer/ * Http2Server), calls the matched handler, then submits the * response back through http3SubmitResponse. Mirrors * Http2Server.dispatchStream's tail without any frame-parsing -- * nghttp3 already did that part in C.
fn runMiddleware(ctx: HttpContext) → Bool
fn matchRoute(ctx: HttpContext) → Bool