1.12 <SoupContentSniffer>

Class: <SoupContentSniffer>

It derives from <GObject>.

Sniffs the mime type of messages.

A ContentSniffer tries to detect the actual content type of the files that are being downloaded by looking at some of the data before the Message emits its "got-headers" signal. ContentSniffer implements SessionFeature, so you can add content sniffing to a session with Session.add_feature or Session.add_feature_by_type.

Procedures

Procedure: content-sniffer:new ⇒ %return

Creates a new ContentSniffer.

%return

Returned: a <SoupContentSniffer>.

a new <SoupContentSniffer>

Method: content-sniffer:sniff self msg buffer ⇒ %return params
Method: sniff self msg buffer ⇒ %return params

Sniffs buffer to determine its Content-Type.

The result may also be influenced by the Content-Type declared in msg’s response headers.

self

Passed: a <SoupContentSniffer>.

a <SoupContentSniffer>

msg

Passed: a <SoupMessage>.

the message to sniff

buffer

Passed: a <GBytes>.

a buffer containing the start of msg’s response body

%return

Returned: a string.

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

params

Returned: a hash table, each key a string and each value a string, or #f.

return location for Content-Type parameters (eg, "charset"), or #f