NetSurf
Functions
mimesniff.h File Reference

MIME type sniffer interface. More...

#include <stdbool.h>
#include <libwapcaplet/libwapcaplet.h>
#include "utils/errors.h"
Include dependency graph for mimesniff.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

nserror mimesniff_compute_effective_type (const char *content_type_header, const uint8_t *data, size_t len, bool sniff_allowed, bool image_only, lwc_string **effective_type)
 Compute the effective MIME type for an object. More...
 

Detailed Description

MIME type sniffer interface.

Definition in file mimesniff.h.

Function Documentation

◆ mimesniff_compute_effective_type()

nserror mimesniff_compute_effective_type ( const char *  content_type_header,
const uint8_t *  data,
size_t  len,
bool  sniff_allowed,
bool  image_only,
lwc_string **  effective_type 
)

Compute the effective MIME type for an object.

The implementation uses the sniffing algorithm described in http://mimesniff.spec.whatwg.org/

Parameters
content_type_headerSource content type header
dataFirst data chunk, or NULL
lenLength of data, in bytes
sniff_allowedWhether MIME type sniffing is allowed
image_onlySniff image types only
effective_typeLocation to receive computed type
Returns
NSERROR_OK on success, NSERROR_NEED_DATA iff data is NULL and data is needed NSERROR_NOT_FOUND if sniffing is prohibited and no Content-Type header was found

Definition at line 563 of file mimesniff.c.

References content_factory_type_from_mime_type(), CONTENT_IMAGE, http_content_type_destroy(), http_parse_content_type(), http_content_type::media_type, mimesniff__compute_feed_or_html(), mimesniff__compute_image(), mimesniff__compute_text_or_binary(), mimesniff__compute_unknown(), NSERROR_NOT_FOUND, NSERROR_OK, S, and SLEN.

Referenced by hlcache_llcache_callback().

Here is the call graph for this function:
Here is the caller graph for this function: