## SoupContentSniffer SoupContentSniffer — Content sniffing for SoupSession |

## Functions

SoupContentSniffer * | soup_content_sniffer_new ()
char * | soup_content_sniffer_sniff ()

## Types and Values

| SoupContentSniffer

## Object Hierarchy

        GObject
        ╰── SoupContentSniffer

## Implemented Interfaces

SoupContentSniffer implements SoupSessionFeature and SoupContentProcessor.

## Includes

    #include <libsoup/soup.h>

## Description

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()`.

## Functions

### soup_content_sniffer_new ()

    SoupContentSniffer *
    soup_content_sniffer_new (void);

Creates a new SoupContentSniffer.

#### Returns

a new SoupContentSniffer

### soup_content_sniffer_sniff ()

    char *
    soup_content_sniffer_sniff (SoupContentSniffer *sniffer,
                                SoupMessage *msg,
                                GBytes *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.

#### Parameters

sniffer | a SoupContentSniffer |
msg | the message to sniff |
buffer | a buffer containing the start of `msg` 's response body |
params | return location for Content-Type parameters (eg, "charset"), or `NULL`. | [element-type utf8 utf8][out][transfer full][nullable]

#### Returns

the sniffed Content-Type of `buffer` ; this will never be `NULL`, but may be "application/octet-stream".

## Types and Values

### SoupContentSniffer

    typedef struct _SoupContentSniffer SoupContentSniffer;

Class that attempts to sniff the mime type of messages.