mime.nx
buildroot/runtime/mime.nx
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
imports: syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 24 | func mime_ext_eq(ext: *u8, n: i64, lit: *u8) -> i64 {
called by 1: mime_from_ext |
| 42 | func mime_from_ext(ext: *u8, n: i64) -> *u8 { |
| 93 | func mime_from_path(path: *u8) -> *u8 { |
| 111 | func main() -> i64 {
calls 1: mime_from_path |