gi-soup-2.4.18: GI/Soup/Flags.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Soup.Flags
(
-- * Flags
-- ** Cacheability #flag:Cacheability#
Cacheability(..) ,
-- ** Expectation #flag:Expectation#
Expectation(..) ,
-- ** MessageFlags #flag:MessageFlags#
MessageFlags(..) ,
-- ** ServerListenOptions #flag:ServerListenOptions#
ServerListenOptions(..) ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
-- Flags ServerListenOptions
{- |
Options to pass to 'GI.Soup.Objects.Server.serverListen', etc.
'GI.Soup.Flags.ServerListenOptionsIpv4Only' and 'GI.Soup.Flags.ServerListenOptionsIpv6Only'
only make sense with 'GI.Soup.Objects.Server.serverListenAll' and
'GI.Soup.Objects.Server.serverListenLocal', not plain 'GI.Soup.Objects.Server.serverListen' (which
simply listens on whatever kind of socket you give it). And you
cannot specify both of them in a single call.
/Since: 2.48/
-}
data ServerListenOptions =
ServerListenOptionsHttps
{- ^
Listen for https connections rather
than plain http.
-}
| ServerListenOptionsIpv4Only
{- ^
Only listen on IPv4 interfaces.
-}
| ServerListenOptionsIpv6Only
{- ^
Only listen on IPv6 interfaces.
-}
| AnotherServerListenOptions Int
-- ^ Catch-all for unknown values
deriving (Show, Eq)
instance P.Enum ServerListenOptions where
fromEnum ServerListenOptionsHttps = 1
fromEnum ServerListenOptionsIpv4Only = 2
fromEnum ServerListenOptionsIpv6Only = 4
fromEnum (AnotherServerListenOptions k) = k
toEnum 1 = ServerListenOptionsHttps
toEnum 2 = ServerListenOptionsIpv4Only
toEnum 4 = ServerListenOptionsIpv6Only
toEnum k = AnotherServerListenOptions k
instance P.Ord ServerListenOptions where
compare a b = P.compare (P.fromEnum a) (P.fromEnum b)
foreign import ccall "soup_server_listen_options_get_type" c_soup_server_listen_options_get_type ::
IO GType
instance BoxedFlags ServerListenOptions where
boxedFlagsType _ = c_soup_server_listen_options_get_type
instance IsGFlag ServerListenOptions
-- Flags MessageFlags
{- |
Various flags that can be set on a 'GI.Soup.Objects.Message.Message' to alter its
behavior.
-}
data MessageFlags =
MessageFlagsNoRedirect
{- ^
The session should not follow redirect
(3xx) responses received by this message.
-}
| MessageFlagsCanRebuild
{- ^
The caller will rebuild the request
body if the message is restarted; see
'GI.Soup.Structs.MessageBody.messageBodySetAccumulate' for more details.
-}
| MessageFlagsOverwriteChunks
{- ^
Deprecated: equivalent to calling
'GI.Soup.Structs.MessageBody.messageBodySetAccumulate' on the incoming message body
(ie, 'GI.Soup.Objects.Message.Message':@/response_body/@ for a client-side request),
passing 'False'.
-}
| MessageFlagsContentDecoded
{- ^
Set by 'GI.Soup.Objects.ContentDecoder.ContentDecoder' to
indicate that it has removed the Content-Encoding on a message (and
so headers such as Content-Length may no longer accurately describe
the body).
-}
| MessageFlagsCertificateTrusted
{- ^
if set after an https response
has been received, indicates that the server\'s SSL certificate is
trusted according to the session\'s CA.
-}
| MessageFlagsNewConnection
{- ^
Requests that the message should be
sent on a newly-created connection, not reusing an existing
persistent connection. Note that messages with non-idempotent
'GI.Soup.Objects.Message.Message':@/method/@\<!-- -->s behave this way by default, unless
@/SOUP_MESSAGE_IDEMPOTENT/@ is set.
-}
| MessageFlagsIdempotent
{- ^
The message is considered idempotent,
regardless its 'GI.Soup.Objects.Message.Message':@/method/@, and allows reuse of existing
idle connections, instead of always requiring a new one, unless
@/SOUP_MESSAGE_NEW_CONNECTION/@ is set.
-}
| MessageFlagsIgnoreConnectionLimits
{- ^
Request that a new connection is
created for the message if there aren\'t idle connections available
and it\'s not possible to create new connections due to any of the
connection limits has been reached. If a dedicated connection is
eventually created for this message, it will be dropped when the
message finishes. Since 2.50
-}
| MessageFlagsDoNotUseAuthCache
{- ^
The 'GI.Soup.Objects.AuthManager.AuthManager' should not use
the credentials cache for this message, neither to use cached credentials
to automatically authenticate this message nor to cache the credentials
after the message is successfully authenticated. This applies to both server
and proxy authentication. Note that 'GI.Soup.Objects.Session.Session'::@/authenticate/@ signal will
be emitted, if you want to disable authentication for a message use
'GI.Soup.Objects.Message.messageDisableFeature' passing @/SOUP_TYPE_AUTH_MANAGER/@ instead. Since 2.58
-}
| AnotherMessageFlags Int
-- ^ Catch-all for unknown values
deriving (Show, Eq)
instance P.Enum MessageFlags where
fromEnum MessageFlagsNoRedirect = 2
fromEnum MessageFlagsCanRebuild = 4
fromEnum MessageFlagsOverwriteChunks = 8
fromEnum MessageFlagsContentDecoded = 16
fromEnum MessageFlagsCertificateTrusted = 32
fromEnum MessageFlagsNewConnection = 64
fromEnum MessageFlagsIdempotent = 128
fromEnum MessageFlagsIgnoreConnectionLimits = 256
fromEnum MessageFlagsDoNotUseAuthCache = 512
fromEnum (AnotherMessageFlags k) = k
toEnum 2 = MessageFlagsNoRedirect
toEnum 4 = MessageFlagsCanRebuild
toEnum 8 = MessageFlagsOverwriteChunks
toEnum 16 = MessageFlagsContentDecoded
toEnum 32 = MessageFlagsCertificateTrusted
toEnum 64 = MessageFlagsNewConnection
toEnum 128 = MessageFlagsIdempotent
toEnum 256 = MessageFlagsIgnoreConnectionLimits
toEnum 512 = MessageFlagsDoNotUseAuthCache
toEnum k = AnotherMessageFlags k
instance P.Ord MessageFlags where
compare a b = P.compare (P.fromEnum a) (P.fromEnum b)
foreign import ccall "soup_message_flags_get_type" c_soup_message_flags_get_type ::
IO GType
instance BoxedFlags MessageFlags where
boxedFlagsType _ = c_soup_message_flags_get_type
instance IsGFlag MessageFlags
-- Flags Expectation
{- |
Represents the parsed value of the \"Expect\" header.
-}
data Expectation =
ExpectationUnrecognized
{- ^
any unrecognized expectation
-}
| ExpectationContinue
{- ^
\"100-continue\"
-}
| AnotherExpectation Int
-- ^ Catch-all for unknown values
deriving (Show, Eq)
instance P.Enum Expectation where
fromEnum ExpectationUnrecognized = 1
fromEnum ExpectationContinue = 2
fromEnum (AnotherExpectation k) = k
toEnum 1 = ExpectationUnrecognized
toEnum 2 = ExpectationContinue
toEnum k = AnotherExpectation k
instance P.Ord Expectation where
compare a b = P.compare (P.fromEnum a) (P.fromEnum b)
foreign import ccall "soup_expectation_get_type" c_soup_expectation_get_type ::
IO GType
instance BoxedFlags Expectation where
boxedFlagsType _ = c_soup_expectation_get_type
instance IsGFlag Expectation
-- Flags Cacheability
{- |
/No description available in the introspection data./
-}
data Cacheability =
CacheabilityCacheable
{- ^
/No description available in the introspection data./
-}
| CacheabilityUncacheable
{- ^
/No description available in the introspection data./
-}
| CacheabilityInvalidates
{- ^
/No description available in the introspection data./
-}
| CacheabilityValidates
{- ^
/No description available in the introspection data./
-}
| AnotherCacheability Int
-- ^ Catch-all for unknown values
deriving (Show, Eq)
instance P.Enum Cacheability where
fromEnum CacheabilityCacheable = 1
fromEnum CacheabilityUncacheable = 2
fromEnum CacheabilityInvalidates = 4
fromEnum CacheabilityValidates = 8
fromEnum (AnotherCacheability k) = k
toEnum 1 = CacheabilityCacheable
toEnum 2 = CacheabilityUncacheable
toEnum 4 = CacheabilityInvalidates
toEnum 8 = CacheabilityValidates
toEnum k = AnotherCacheability k
instance P.Ord Cacheability where
compare a b = P.compare (P.fromEnum a) (P.fromEnum b)
foreign import ccall "soup_cacheability_get_type" c_soup_cacheability_get_type ::
IO GType
instance BoxedFlags Cacheability where
boxedFlagsType _ = c_soup_cacheability_get_type
instance IsGFlag Cacheability