Dillo v3.1.1-119-g140d9ebd
|
#include <stddef.h>
Go to the source code of this file.
Macros | |
#define | d_isascii(c) (((c) & ~0x7f) == 0) |
Functions | |
char * | a_Misc_escape_chars (const char *str, const char *esc_set) |
Escape characters as XX sequences. | |
int | a_Misc_expand_tabs (char **start, char *end, char *buf, int buflen) |
Takes a string and converts any tabs to spaces. | |
int | a_Misc_get_content_type_from_data (void *Data, size_t Size, const char **PT) |
Detects 'Content-Type' from a data stream sample. | |
int | a_Misc_content_type_check (const char *EntryType, const char *DetectedType) |
Check the server-supplied 'Content-Type' against our detected type. | |
void | a_Misc_parse_content_type (const char *str, char **major, char **minor, char **charset) |
Parse Content-Type string, e.g., "text/html; charset=utf-8". | |
int | a_Misc_content_type_cmp (const char *ct1, const char *ct2) |
Compare two Content-Type strings. | |
int | a_Misc_parse_geometry (char *geom, int *x, int *y, int *w, int *h) |
Parse a geometry string. | |
int | a_Misc_parse_search_url (char *source, char **label, char **urlstr) |
Parse dillorc's search_url string ([<label> ]<url> ) Return value: -1 on error, 0 on success (and label and urlstr pointers) | |
char * | a_Misc_encode_base64 (const char *in) |
Encodes string using base64 encoding. | |
Dstr * | a_Misc_file2dstr (const char *filename) |
Load a local file into a dStr. | |
int a_Misc_content_type_check | ( | const char * | EntryType, |
const char * | DetectedType | ||
) |
Check the server-supplied 'Content-Type' against our detected type.
(some servers seem to default to "text/plain").
There are many MIME types Dillo doesn't know, they're handled as "application/octet-stream" (as the SPEC says).
A mismatch happens when receiving a binary stream as "text/plain" or "text/html", or an image that's not an image of its kind.
Note: this is a basic security procedure.
Definition at line 321 of file misc.c.
References _MSG, dStrnAsciiCasecmp(), and MimeTypes.
Referenced by Cache_process_queue().
int a_Misc_content_type_cmp | ( | const char * | ct1, |
const char * | ct2 | ||
) |
Compare two Content-Type strings.
Return 0 if they are equivalent, and 1 otherwise.
Definition at line 274 of file misc.c.
References a_Misc_parse_content_type(), dFree(), and dStrAsciiCasecmp().
Referenced by a_Cache_set_content_type(), and Html_update_content_type().
char * a_Misc_encode_base64 | ( | const char * | in | ) |
Encodes string using base64 encoding.
Return value: new string or NULL if input string is empty.
Definition at line 425 of file misc.c.
References dMalloc().
Referenced by a_Http_set_proxy_passwd(), and Auth_do_auth_dialog_cb().
char * a_Misc_escape_chars | ( | const char * | str, |
const char * | esc_set | ||
) |
Escape characters as XX sequences.
Return value: New string.
Definition at line 26 of file misc.c.
References dStr_append_c(), dStr_free(), dStr_sized_new(), FALSE, and Dstr::str.
Referenced by a_Dialog_open_file(), and makeStartUrl().
int a_Misc_expand_tabs | ( | char ** | start, |
char * | end, | ||
char * | buf, | ||
int | buflen | ||
) |
Takes a string and converts any tabs to spaces.
Definition at line 54 of file misc.c.
References a_Utf8_combining_char(), a_Utf8_decode(), and TAB_SIZE.
Dstr * a_Misc_file2dstr | ( | const char * | filename | ) |
Load a local file into a dStr.
Return value: dStr on success, NULL on error. TODO: a filesize threshold may be implemented.
Definition at line 464 of file misc.c.
References dStr_append_l(), and dStr_sized_new().
Referenced by StyleEngine::buildUserStyle().
int a_Misc_get_content_type_from_data | ( | void * | Data, |
size_t | Size, | ||
const char ** | PT | ||
) |
Detects 'Content-Type' from a data stream sample.
It uses the magic(5) logic from file(1). Currently, it only checks the few mime types that Dillo supports.
'Data' is a pointer to the first bytes of the raw data.
Return value: (0 on success, 1 on doubt, 2 on lack of data).
Definition at line 136 of file misc.c.
References a_Utf8_end_of_char(), a_Utf8_test(), dIsspace, dStrnAsciiCasecmp(), DT_IMAGE_GIF, DT_IMAGE_JPG, DT_IMAGE_PNG, DT_OCTET_STREAM, DT_TEXT_HTML, DT_TEXT_PLAIN, MimeTypes, and MIN.
Referenced by Cache_process_queue().
void a_Misc_parse_content_type | ( | const char * | type, |
char ** | major, | ||
char ** | minor, | ||
char ** | charset | ||
) |
Parse Content-Type string, e.g., "text/html; charset=utf-8".
Content-Type is defined in RFC 2045 section 5.1.
Definition at line 210 of file misc.c.
References d_isascii, dStriAsciiStr(), dStrnAsciiCasecmp(), and dStrndup().
Referenced by a_Cache_set_content_type(), a_Misc_content_type_cmp(), a_UIcmd_view_page_source(), and DilloHtml::DilloHtml().
int a_Misc_parse_geometry | ( | char * | geom, |
int * | x, | ||
int * | y, | ||
int * | w, | ||
int * | h | ||
) |
Parse a geometry string.
Definition at line 360 of file misc.c.
References _MSG.
Referenced by main(), and parseOption().
int a_Misc_parse_search_url | ( | char * | source, |
char ** | label, | ||
char ** | urlstr | ||
) |
Parse dillorc's search_url string ([<label> ]<url>
) Return value: -1 on error, 0 on success (and label and urlstr pointers)
Definition at line 391 of file misc.c.
Referenced by a_Dialog_input(), and UIcmd_make_search_str().