gi-soup-3.0.2: Libsoup bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Soup.Objects.ContentSniffer

Description

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 [classmessage] emits its signalmessage[gotHeaders] signal. ContentSniffer implements [ifacesessionFeature], so you can add content sniffing to a session with [methodsession.add_feature] or [methodsession.add_feature_by_type].

Synopsis

Exported types

newtype ContentSniffer Source #

Memory-managed wrapper type.

Constructors

ContentSniffer (ManagedPtr ContentSniffer) 

Instances

Instances details
Eq ContentSniffer Source # 
Instance details

Defined in GI.Soup.Objects.ContentSniffer

GObject ContentSniffer Source # 
Instance details

Defined in GI.Soup.Objects.ContentSniffer

ManagedPtrNewtype ContentSniffer Source # 
Instance details

Defined in GI.Soup.Objects.ContentSniffer

TypedObject ContentSniffer Source # 
Instance details

Defined in GI.Soup.Objects.ContentSniffer

Methods

glibType :: IO GType

HasParentTypes ContentSniffer Source # 
Instance details

Defined in GI.Soup.Objects.ContentSniffer

IsGValue (Maybe ContentSniffer) Source #

Convert ContentSniffer to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Soup.Objects.ContentSniffer

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe ContentSniffer -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe ContentSniffer)

type ParentTypes ContentSniffer Source # 
Instance details

Defined in GI.Soup.Objects.ContentSniffer

type ParentTypes ContentSniffer = '[Object, SessionFeature]

class (GObject o, IsDescendantOf ContentSniffer o) => IsContentSniffer o Source #

Type class for types which can be safely cast to ContentSniffer, for instance with toContentSniffer.

Instances

Instances details
(GObject o, IsDescendantOf ContentSniffer o) => IsContentSniffer o Source # 
Instance details

Defined in GI.Soup.Objects.ContentSniffer

toContentSniffer :: (MonadIO m, IsContentSniffer o) => o -> m ContentSniffer Source #

Cast to ContentSniffer, for types for which this is known to be safe. For general casts, use castTo.

Methods

new

contentSnifferNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m ContentSniffer

Returns: a new ContentSniffer

Creates a new ContentSniffer.

sniff

contentSnifferSniff Source #

Arguments

:: (HasCallStack, MonadIO m, IsContentSniffer a, IsMessage b) 
=> a

sniffer: a ContentSniffer

-> b

msg: the message to sniff

-> Bytes

buffer: a buffer containing the start of msg's response body

-> m (Text, Maybe (Map Text Text))

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

Sniffs buffer to determine its Content-Type.

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