Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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 gotHeaders signal.
ContentSniffer
implements SessionFeature
, so you can add
content sniffing to a session with sessionAddFeature
or
sessionAddFeatureByType
.
Since: 2.28
Synopsis
- newtype ContentSniffer = ContentSniffer (ManagedPtr ContentSniffer)
- class (GObject o, IsDescendantOf ContentSniffer o) => IsContentSniffer o
- toContentSniffer :: (MonadIO m, IsContentSniffer o) => o -> m ContentSniffer
- contentSnifferGetBufferSize :: (HasCallStack, MonadIO m, IsContentSniffer a) => a -> m Word64
- contentSnifferNew :: (HasCallStack, MonadIO m) => m ContentSniffer
- contentSnifferSniff :: (HasCallStack, MonadIO m, IsContentSniffer a, IsMessage b) => a -> b -> Buffer -> m (Text, Map Text Text)
Exported types
newtype ContentSniffer Source #
Memory-managed wrapper type.
ContentSniffer (ManagedPtr ContentSniffer) |
Instances
Eq ContentSniffer Source # | |
Defined in GI.Soup.Objects.ContentSniffer (==) :: ContentSniffer -> ContentSniffer -> Bool # (/=) :: ContentSniffer -> ContentSniffer -> Bool # | |
GObject ContentSniffer Source # | |
Defined in GI.Soup.Objects.ContentSniffer | |
ManagedPtrNewtype ContentSniffer Source # | |
Defined in GI.Soup.Objects.ContentSniffer toManagedPtr :: ContentSniffer -> ManagedPtr ContentSniffer | |
TypedObject ContentSniffer Source # | |
Defined in GI.Soup.Objects.ContentSniffer | |
HasParentTypes ContentSniffer Source # | |
Defined in GI.Soup.Objects.ContentSniffer | |
IsGValue (Maybe ContentSniffer) Source # | Convert |
Defined in GI.Soup.Objects.ContentSniffer gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe ContentSniffer -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe ContentSniffer) | |
type ParentTypes ContentSniffer Source # | |
Defined in GI.Soup.Objects.ContentSniffer |
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
(GObject o, IsDescendantOf ContentSniffer o) => IsContentSniffer o Source # | |
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
Click to display all available methods, including inherited ones
Methods
addFeature, attach, bindProperty, bindPropertyFull, detach, forceFloating, freezeNotify, getv, hasFeature, isFloating, notify, notifyByPspec, ref, refSink, removeFeature, runDispose, sniff, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getBufferSize, getData, getProperty, getQdata.
Setters
getBufferSize
contentSnifferGetBufferSize Source #
:: (HasCallStack, MonadIO m, IsContentSniffer a) | |
=> a |
|
-> m Word64 | Returns: the number of bytes to sniff |
Gets the number of bytes sniffer
needs in order to properly sniff
a buffer.
Since: 2.28
new
:: (HasCallStack, MonadIO m) | |
=> m ContentSniffer | Returns: a new |
Creates a new ContentSniffer
.
Since: 2.28
sniff
:: (HasCallStack, MonadIO m, IsContentSniffer a, IsMessage b) | |
=> a |
|
-> b |
|
-> Buffer |
|
-> m (Text, Map Text Text) | Returns: the sniffed Content-Type of |
Sniffs buffer
to determine its Content-Type. The result may also
be influenced by the Content-Type declared in msg
's response
headers.
Since: 2.28