libonion
|
Functions | |
void | onion_mime_set (onion_dict *d) |
Sets a user set dict as mime dictThis dict maps "extension" -> "mimetype". | |
const char * | onion_mime_get (const char *filename) |
Given a filename or extensiton, it returns the proper mime type.If onion_mime_set was called before, it is used, else it reads mime types /etc/mime.types. | |
void | onion_mime_update (const char *extension, const char *mimetype) |
Allow to update mime types.User can add new mime types, or remove (if mimetype == NULL). |
const char* onion_mime_get | ( | const char * | filename | ) |
Given a filename or extensiton, it returns the proper mime type.If onion_mime_set was called before, it is used, else it reads mime types /etc/mime.types.
Returns a mime type based on the file name.
Full mime catalog, from /etc/mime.types, takes about 36kb on ubuntu 10.10, may depend on how many mime types are known.
If none is found, returns text/plain.
References onion_dict_t::onion_dict_get().
Referenced by onion_shortcut_response_file().
void onion_mime_set | ( | onion_dict * | d | ) |
Sets a user set dict as mime dictThis dict maps "extension" -> "mimetype".
Sets the mime dictionary (extension -> mime_type)
At onion_server_free it is freed, as if this function is called again.
References onion_dict_t::onion_dict_free().
Referenced by onion_free().
void onion_mime_update | ( | const char * | extension, |
const char * | mimetype | ||
) |
Allow to update mime types.User can add new mime types, or remove (if mimetype == NULL).
Updates a mime record, for that extensions set that mimetype. If mimetype==NULL, removes it.
References OD_DUP_ALL, onion_dict_t::onion_dict_add(), and onion_dict_t::onion_dict_remove().