NetSurf
|
file extension to mimetype mapping for the GTK frontend More...
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <strings.h>
#include <gtk/gtk.h>
#include "utils/log.h"
#include "utils/hashtable.h"
#include "utils/filepath.h"
#include "utils/file.h"
#include "utils/nsurl.h"
#include "utils/ascii.h"
#include "netsurf/fetch.h"
#include "gtk/gui.h"
#include "gtk/resources.h"
#include "gtk/fetch.h"
Go to the source code of this file.
Macros | |
#define | HASH_SIZE 117 |
#define | MAX_LINE_LEN 256 |
Functions | |
void | gtk_fetch_filetype_init (const char *mimefile) |
void | gtk_fetch_filetype_fin (void) |
const char * | fetch_filetype (const char *unix_path) |
filetype – determine the MIME type of a local file More... | |
static nsurl * | nsgtk_get_resource_url (const char *path) |
Variables | |
static struct hash_table * | mime_hash = NULL |
static struct gui_fetch_table | fetch_table |
struct gui_fetch_table * | nsgtk_fetch_table = &fetch_table |
file extension to mimetype mapping for the GTK frontend
allows GTK frontend to map file extension to mime types using a default builtin list and /etc/mime.types file if present.
mime type and content type handling is derived from the BNF in RFC822 section 3.3, RFC2045 section 5.1 and RFC6838 section 4.2. Upshot is their charset and parsing is all a strict subset of ASCII hence not using locale dependant ctype functions for parsing.
Definition in file fetch.c.
const char * fetch_filetype | ( | const char * | unix_path | ) |
filetype – determine the MIME type of a local file
Determine the MIME type of a local file.
Definition at line 184 of file fetch.c.
References ascii_to_lower(), hash_get(), mime_hash, and type.
void gtk_fetch_filetype_fin | ( | void | ) |
Definition at line 179 of file fetch.c.
References hash_destroy(), and mime_hash.
Referenced by nsgtk_finalise().
void gtk_fetch_filetype_init | ( | const char * | mimefile | ) |
Definition at line 60 of file fetch.c.
References ascii_is_space(), hash_add(), hash_create(), HASH_SIZE, line(), MAX_LINE_LEN, mime_hash, NSLOG, and type.
Referenced by nsgtk_setup().
|
static |
Definition at line 251 of file fetch.c.
References filepath_sfind(), netsurf_path_to_nsurl(), nsurl_create(), path(), PATH_MAX, and respaths.
|
static |
|
static |
Definition at line 58 of file fetch.c.
Referenced by fetch_filetype(), gtk_fetch_filetype_fin(), and gtk_fetch_filetype_init().
struct gui_fetch_table* nsgtk_fetch_table = &fetch_table |