Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
HTTP MIME: media type from a file extension

Functions

int n_http_mime_table_check (void)
 check that the built-in table is sorted, as its lookup requires
const char * n_http_mime_type (const char *path, size_t len)
 media type for a path or file name, from its extension

Detailed Description

Function Documentation

◆ n_http_mime_table_check()

int n_http_mime_table_check ( void )

check that the built-in table is sorted, as its lookup requires

Returns
1 when sorted, 0 otherwise (a library bug)

Definition at line 132 of file n_http_mime.c.

References _mime_table.

Referenced by main().

Here is the caller graph for this function:

◆ n_http_mime_type()

const char * n_http_mime_type ( const char * path,
size_t len )

media type for a path or file name, from its extension

"/Games/a/index.HTML?x=1" gives "text/html". The extension is what follows the last '.' of the last segment ("/a.b/file" has none, nor do ".htaccess" and "file."). Text types are returned without a charset.

Parameters
paththe path or name (may be NULL only when len is 0)
lenits length
Returns
a static string, or NULL when the extension is unknown or absent
Parameters
paththe path or name (may be NULL only when len is 0)
lenits length
Returns
a static string, or NULL when the extension is unknown or absent

Definition at line 90 of file n_http_mime.c.

References _mime_table.

Referenced by expect_type(), and main().

Here is the caller graph for this function: