code wiki / (root) / mime.nx

mime.nx

buildroot/runtime/mime.nx

5055 B119 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

mime.nx -- MIME type lookup by file extension. Used by HTTP servers (http_resp.nx) to set Content-Type from file extensions when serving static content. Small curated table of ~30 types covering 99% of web workloads. Not exhaustive; callers needing obscure types either extend the table here or pass the Content-Type explicitly. No mime- magic byte sniffing today; that's a future security-concern module (misclassifying an HTML file as text/plain can enable XSS in some contexts). Invariants: M1 Lookup is case-insensitive on the extension. M2 Unknown extensions return "application/octet-stream" (RFC 2046 default for "raw bytes of unknown type"). M3 Returned strings are const cstrings; caller must NOT free them.

dependencies 1 imports · 0 importers

syscalls.nx mime.nx

imports: syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main mime_from_path mime_from_ext mime_ext_eq

structs

none

consts

none

functions

24func mime_ext_eq(ext: *u8, n: i64, lit: *u8) -> i64 {
called by 1: mime_from_ext
42func mime_from_ext(ext: *u8, n: i64) -> *u8 {
called by 1: mime_from_path calls 1: mime_ext_eq
93func mime_from_path(path: *u8) -> *u8 {
called by 1: main calls 1: mime_from_ext
111func main() -> i64 {
calls 1: mime_from_path