2005-09-15 09:58:31 -04:00
|
|
|
#ifndef EL__MIME_MIME_H
|
|
|
|
#define EL__MIME_MIME_H
|
|
|
|
|
|
|
|
#include "main/module.h"
|
|
|
|
|
2020-10-05 14:14:55 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2005-09-15 09:58:31 -04:00
|
|
|
struct cache_entry;
|
|
|
|
struct uri;
|
|
|
|
|
|
|
|
struct mime_handler {
|
2021-01-02 10:20:27 -05:00
|
|
|
char *description;
|
2022-01-14 15:08:04 -05:00
|
|
|
const char *backend_name;
|
2022-05-21 12:17:04 -04:00
|
|
|
char *inpext;
|
|
|
|
char *outext;
|
2005-09-15 09:58:31 -04:00
|
|
|
unsigned int ask:1;
|
|
|
|
unsigned int block:1;
|
2010-07-24 11:07:18 -04:00
|
|
|
unsigned int copiousoutput:1;
|
2022-05-21 12:17:04 -04:00
|
|
|
unsigned int dgi:1;
|
2021-01-02 10:20:27 -05:00
|
|
|
char program[1]; /* XXX: Keep last! */
|
2005-09-15 09:58:31 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct module mime_module;
|
|
|
|
|
|
|
|
/* Guess content type of the document. Either from the protocol header or
|
|
|
|
* scanning the uri for extensions. */
|
2021-01-02 10:20:27 -05:00
|
|
|
char *get_content_type(struct cache_entry *cached);
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
/* Guess content type by looking at configurations of the given @extension */
|
2021-01-02 10:20:27 -05:00
|
|
|
char *get_extension_content_type(char *extension);
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
/* Find program to handle mimetype. The @xwin tells about X capabilities. */
|
|
|
|
struct mime_handler *
|
2021-01-02 10:20:27 -05:00
|
|
|
get_mime_type_handler(char *content_type, int xwin);
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
/* Extracts strictly the filename part (the crap between path and query) and
|
|
|
|
* adds it to the @string. Note that there are cases where the string will be
|
|
|
|
* empty ("") (ie. http://example.com/?crash=elinks). */
|
2019-04-21 06:27:40 -04:00
|
|
|
struct string *add_mime_filename_to_string(struct string *string, struct uri *uri);
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2020-10-05 14:14:55 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-09-15 09:58:31 -04:00
|
|
|
#endif
|