NetSurf
content
mimesniff.h
Go to the documentation of this file.
1
/*
2
* Copyright 2011 John-Mark Bell <jmb@netsurf-browser.org>
3
*
4
* This file is part of NetSurf, http://www.netsurf-browser.org/
5
*
6
* NetSurf is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
9
*
10
* NetSurf is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
/**
20
* \file
21
* MIME type sniffer interface
22
*/
23
24
#ifndef NETSURF_CONTENT_MIMESNIFF_H_
25
#define NETSURF_CONTENT_MIMESNIFF_H_
26
27
#include <stdbool.h>
28
29
#include <libwapcaplet/libwapcaplet.h>
30
#include "
utils/errors.h
"
31
32
struct
llcache_handle
;
33
34
/**
35
* Compute the effective MIME type for an object
36
*
37
* The implementation uses the sniffing algorithm described in
38
* http://mimesniff.spec.whatwg.org/
39
*
40
* \param content_type_header Source content type header
41
* \param data First data chunk, or NULL
42
* \param len Length of \a data, in bytes
43
* \param sniff_allowed Whether MIME type sniffing is allowed
44
* \param image_only Sniff image types only
45
* \param effective_type Location to receive computed type
46
* \return NSERROR_OK on success,
47
* NSERROR_NEED_DATA iff \a data is NULL and data is needed
48
* NSERROR_NOT_FOUND if sniffing is prohibited and no
49
* Content-Type header was found
50
*/
51
nserror
mimesniff_compute_effective_type
(
const
char
*content_type_header,
52
const
uint8_t *data,
size_t
len,
bool
sniff_allowed,
53
bool
image_only, lwc_string **effective_type);
54
55
#endif
errors.h
Error codes.
nserror
nserror
Enumeration of error codes.
Definition:
errors.h:29
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.
Definition:
mimesniff.c:563
llcache_handle
Handle to low-level cache object.
Definition:
llcache.c:76
Generated on Tue Nov 12 2024 23:39:46 for NetSurf by
1.9.4