| libsoup Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Implemented Interfaces | ||||
SoupContentSnifferSoupContentSniffer — Content sniffing for SoupSession |
#include <libsoup/soup.h>
SoupContentSniffer;
SoupContentSniffer * soup_content_sniffer_new (void);
char * soup_content_sniffer_sniff (SoupContentSniffer *sniffer,
SoupMessage *msg,
SoupBuffer *buffer,
GHashTable **params);
gsize soup_content_sniffer_get_buffer_size
(SoupContentSniffer *sniffer);
A SoupContentSniffer tries to detect the actual content type of
the files that are being downloaded by looking at some of the data
before the SoupMessage emits its "got-headers" signal.
SoupContentSniffer implements SoupSessionFeature, so you can add
content sniffing to a session with soup_session_add_feature() or
soup_session_add_feature_by_type().
SoupContentSniffer * soup_content_sniffer_new (void);
Creates a new SoupContentSniffer.
Returns : |
a new SoupContentSniffer |
Since 2.28
char * soup_content_sniffer_sniff (SoupContentSniffer *sniffer,SoupMessage *msg,SoupBuffer *buffer,GHashTable **params);
Sniffs buffer to determine its Content-Type. The result may also
be influenced by the Content-Type declared in msg's response
headers.
|
a SoupContentSniffer |
|
the message to sniff |
|
a buffer containing the start of msg's response body |
|
return
location for Content-Type parameters (eg, "charset"), or NULL. [element-type utf8 utf8][out][transfer full][allow-none]
|
Returns : |
the sniffed Content-Type of buffer; this will never be NULL,
but may be "application/octet-stream". |
Since 2.28
gsize soup_content_sniffer_get_buffer_size
(SoupContentSniffer *sniffer);
Gets the number of bytes sniffer needs in order to properly sniff
a buffer.
|
a SoupContentSniffer |
Returns : |
the number of bytes to sniff |
Since 2.28