{- | 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.Functions ( -- * Methods -- ** checkVersion #method:checkVersion# checkVersion , -- ** cookiesFromRequest #method:cookiesFromRequest# cookiesFromRequest , -- ** cookiesFromResponse #method:cookiesFromResponse# cookiesFromResponse , -- ** cookiesToCookieHeader #method:cookiesToCookieHeader# cookiesToCookieHeader , -- ** cookiesToRequest #method:cookiesToRequest# cookiesToRequest , -- ** cookiesToResponse #method:cookiesToResponse# cookiesToResponse , -- ** formEncodeDatalist #method:formEncodeDatalist# formEncodeDatalist , -- ** formEncodeHash #method:formEncodeHash# formEncodeHash , -- ** formRequestNewFromDatalist #method:formRequestNewFromDatalist# formRequestNewFromDatalist , -- ** formRequestNewFromHash #method:formRequestNewFromHash# formRequestNewFromHash , -- ** formRequestNewFromMultipart #method:formRequestNewFromMultipart# formRequestNewFromMultipart , -- ** getMajorVersion #method:getMajorVersion# getMajorVersion , -- ** getMicroVersion #method:getMicroVersion# getMicroVersion , -- ** getMinorVersion #method:getMinorVersion# getMinorVersion , -- ** headerContains #method:headerContains# headerContains , -- ** headerFreeParamList #method:headerFreeParamList# headerFreeParamList , -- ** headerGStringAppendParam #method:headerGStringAppendParam# headerGStringAppendParam , -- ** headerGStringAppendParamQuoted #method:headerGStringAppendParamQuoted# headerGStringAppendParamQuoted , -- ** headerParseList #method:headerParseList# headerParseList , -- ** headerParseParamList #method:headerParseParamList# headerParseParamList , -- ** headerParseParamListStrict #method:headerParseParamListStrict# headerParseParamListStrict , -- ** headerParseQualityList #method:headerParseQualityList# headerParseQualityList , -- ** headerParseSemiParamList #method:headerParseSemiParamList# headerParseSemiParamList , -- ** headerParseSemiParamListStrict #method:headerParseSemiParamListStrict# headerParseSemiParamListStrict , -- ** headersParse #method:headersParse# headersParse , -- ** headersParseRequest #method:headersParseRequest# headersParseRequest , -- ** headersParseResponse #method:headersParseResponse# headersParseResponse , -- ** headersParseStatusLine #method:headersParseStatusLine# headersParseStatusLine , -- ** httpErrorQuark #method:httpErrorQuark# httpErrorQuark , -- ** strCaseEqual #method:strCaseEqual# strCaseEqual , -- ** strCaseHash #method:strCaseHash# strCaseHash , -- ** tldDomainIsPublicSuffix #method:tldDomainIsPublicSuffix# tldDomainIsPublicSuffix , -- ** tldGetBaseDomain #method:tldGetBaseDomain# tldGetBaseDomain , -- ** valueArrayNew #method:valueArrayNew# valueArrayNew , -- ** websocketClientPrepareHandshake #method:websocketClientPrepareHandshake# websocketClientPrepareHandshake , -- ** websocketClientVerifyHandshake #method:websocketClientVerifyHandshake# websocketClientVerifyHandshake , -- ** websocketServerCheckHandshake #method:websocketServerCheckHandshake# websocketServerCheckHandshake , -- ** websocketServerProcessHandshake #method:websocketServerProcessHandshake# websocketServerProcessHandshake , -- ** xmlrpcBuildMethodCall #method:xmlrpcBuildMethodCall# xmlrpcBuildMethodCall , -- ** xmlrpcBuildMethodResponse #method:xmlrpcBuildMethodResponse# xmlrpcBuildMethodResponse , -- ** xmlrpcBuildRequest #method:xmlrpcBuildRequest# xmlrpcBuildRequest , -- ** xmlrpcBuildResponse #method:xmlrpcBuildResponse# xmlrpcBuildResponse , -- ** xmlrpcMessageNew #method:xmlrpcMessageNew# xmlrpcMessageNew , -- ** xmlrpcMessageSetResponse #method:xmlrpcMessageSetResponse# xmlrpcMessageSetResponse , -- ** xmlrpcParseMethodCall #method:xmlrpcParseMethodCall# xmlrpcParseMethodCall , -- ** xmlrpcParseMethodResponse #method:xmlrpcParseMethodResponse# xmlrpcParseMethodResponse , -- ** xmlrpcParseRequest #method:xmlrpcParseRequest# xmlrpcParseRequest , -- ** xmlrpcParseResponse #method:xmlrpcParseResponse# xmlrpcParseResponse , -- ** xmlrpcVariantGetDatetime #method:xmlrpcVariantGetDatetime# xmlrpcVariantGetDatetime , -- ** xmlrpcVariantNewDatetime #method:xmlrpcVariantNewDatetime# xmlrpcVariantNewDatetime , ) 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 import qualified GI.GLib.Structs.Data as GLib.Data import qualified GI.GLib.Structs.String as GLib.String import qualified GI.GObject.Structs.ValueArray as GObject.ValueArray import {-# SOURCE #-} qualified GI.Soup.Enums as Soup.Enums import {-# SOURCE #-} qualified GI.Soup.Objects.Message as Soup.Message import {-# SOURCE #-} qualified GI.Soup.Structs.Cookie as Soup.Cookie import {-# SOURCE #-} qualified GI.Soup.Structs.Date as Soup.Date import {-# SOURCE #-} qualified GI.Soup.Structs.MessageHeaders as Soup.MessageHeaders import {-# SOURCE #-} qualified GI.Soup.Structs.Multipart as Soup.Multipart import {-# SOURCE #-} qualified GI.Soup.Structs.XMLRPCParams as Soup.XMLRPCParams -- function soup_xmlrpc_variant_new_datetime -- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "Soup", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just TVariant -- throws : False -- Skip return : False foreign import ccall "soup_xmlrpc_variant_new_datetime" soup_xmlrpc_variant_new_datetime :: Ptr Soup.Date.Date -> -- date : TInterface (Name {namespace = "Soup", name = "Date"}) IO (Ptr GVariant) {- | Construct a special 'GVariant' used to serialize a <dateTime.iso8601> node. See 'GI.Soup.Functions.xmlrpcBuildRequest'. The actual type of the returned 'GVariant' is unspecified and \"v\" or \"*\" should be used in variant format strings. For example: \<informalexample>\<programlisting> args = g_variant_new (\"(v)\", soup_xmlrpc_variant_new_datetime (date)); \<\/programlisting>\<\/informalexample> /Since: 2.52/ -} xmlrpcVariantNewDatetime :: (B.CallStack.HasCallStack, MonadIO m) => Soup.Date.Date {- ^ /@date@/: a 'GI.Soup.Structs.Date.Date' -} -> m GVariant {- ^ __Returns:__ a floating 'GVariant'. -} xmlrpcVariantNewDatetime date = liftIO $ do date' <- unsafeManagedPtrGetPtr date result <- soup_xmlrpc_variant_new_datetime date' checkUnexpectedReturnNULL "xmlrpcVariantNewDatetime" result result' <- B.GVariant.wrapGVariantPtr result touchManagedPtr date return result' -- function soup_xmlrpc_variant_get_datetime -- Args : [Arg {argCName = "variant", argType = TVariant, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GVariant", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Soup", name = "Date"})) -- throws : True -- Skip return : False foreign import ccall "soup_xmlrpc_variant_get_datetime" soup_xmlrpc_variant_get_datetime :: Ptr GVariant -> -- variant : TVariant Ptr (Ptr GError) -> -- error IO (Ptr Soup.Date.Date) {- | Get the 'GI.Soup.Structs.Date.Date' from special 'GVariant' created by 'GI.Soup.Functions.xmlrpcVariantNewDatetime' or by parsing a <dateTime.iso8601> node. See 'GI.Soup.Structs.XMLRPCParams.xMLRPCParamsParse'. If /@variant@/ does not contain a datetime it will return an error but it is not considered a programmer error because it generally means parameters received are not in the expected type. /Since: 2.52/ -} xmlrpcVariantGetDatetime :: (B.CallStack.HasCallStack, MonadIO m) => GVariant {- ^ /@variant@/: a 'GVariant' -} -> m Soup.Date.Date {- ^ __Returns:__ a new 'GI.Soup.Structs.Date.Date', or 'Nothing' on error. /(Can throw 'Data.GI.Base.GError.GError')/ -} xmlrpcVariantGetDatetime variant = liftIO $ do variant' <- unsafeManagedPtrGetPtr variant onException (do result <- propagateGError $ soup_xmlrpc_variant_get_datetime variant' checkUnexpectedReturnNULL "xmlrpcVariantGetDatetime" result result' <- (wrapBoxed Soup.Date.Date) result touchManagedPtr variant return result' ) (do return () ) -- function soup_xmlrpc_parse_response -- Args : [Arg {argCName = "method_response", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the XML-RPC methodResponse string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @method_response, or -1 if it is NUL-terminated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "signature", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A valid #GVariant type string, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just TVariant -- throws : True -- Skip return : False foreign import ccall "soup_xmlrpc_parse_response" soup_xmlrpc_parse_response :: CString -> -- method_response : TBasicType TUTF8 Int32 -> -- length : TBasicType TInt CString -> -- signature : TBasicType TUTF8 Ptr (Ptr GError) -> -- error IO (Ptr GVariant) {- | Parses /@methodResponse@/ and returns the return value. If /@methodResponse@/ is a fault, 'Nothing' is returned, and /@error@/ will be set to an error in the @/SOUP_XMLRPC_FAULT/@ domain, with the error code containing the fault code, and the error message containing the fault string. If /@methodResponse@/ cannot be parsed, 'Nothing' is returned, and /@error@/ will be set to an error in the @/SOUP_XMLRPC_ERROR/@ domain. See 'GI.Soup.Structs.XMLRPCParams.xMLRPCParamsParse' for deserialization details. /Since: 2.52/ -} xmlrpcParseResponse :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@methodResponse@/: the XML-RPC methodResponse string -} -> Int32 {- ^ /@length@/: the length of /@methodResponse@/, or -1 if it is NUL-terminated -} -> Maybe (T.Text) {- ^ /@signature@/: A valid 'GVariant' type string, or 'Nothing' -} -> m GVariant {- ^ __Returns:__ a new (non-floating) 'GVariant', or 'Nothing' /(Can throw 'Data.GI.Base.GError.GError')/ -} xmlrpcParseResponse methodResponse length_ signature = liftIO $ do methodResponse' <- textToCString methodResponse maybeSignature <- case signature of Nothing -> return nullPtr Just jSignature -> do jSignature' <- textToCString jSignature return jSignature' onException (do result <- propagateGError $ soup_xmlrpc_parse_response methodResponse' length_ maybeSignature checkUnexpectedReturnNULL "xmlrpcParseResponse" result result' <- B.GVariant.wrapGVariantPtr result freeMem methodResponse' freeMem maybeSignature return result' ) (do freeMem methodResponse' freeMem maybeSignature ) -- function soup_xmlrpc_parse_request -- Args : [Arg {argCName = "method_call", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the XML-RPC methodCall string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @method_call, or -1 if it is NUL-terminated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "params", argType = TInterface (Name {namespace = "Soup", name = "XMLRPCParams"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "on success, a new #SoupXMLRPCParams", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Just (TBasicType TUTF8) -- throws : True -- Skip return : False foreign import ccall "soup_xmlrpc_parse_request" soup_xmlrpc_parse_request :: CString -> -- method_call : TBasicType TUTF8 Int32 -> -- length : TBasicType TInt Ptr (Ptr Soup.XMLRPCParams.XMLRPCParams) -> -- params : TInterface (Name {namespace = "Soup", name = "XMLRPCParams"}) Ptr (Ptr GError) -> -- error IO CString {- | Parses /@methodCall@/ and return the method name. Method parameters can be parsed later using 'GI.Soup.Structs.XMLRPCParams.xMLRPCParamsParse'. /Since: 2.52/ -} xmlrpcParseRequest :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@methodCall@/: the XML-RPC methodCall string -} -> Int32 {- ^ /@length@/: the length of /@methodCall@/, or -1 if it is NUL-terminated -} -> m ((T.Text, Soup.XMLRPCParams.XMLRPCParams)) {- ^ __Returns:__ method\'s name, or 'Nothing' on error. /(Can throw 'Data.GI.Base.GError.GError')/ -} xmlrpcParseRequest methodCall length_ = liftIO $ do methodCall' <- textToCString methodCall params <- allocMem :: IO (Ptr (Ptr Soup.XMLRPCParams.XMLRPCParams)) onException (do result <- propagateGError $ soup_xmlrpc_parse_request methodCall' length_ params checkUnexpectedReturnNULL "xmlrpcParseRequest" result result' <- cstringToText result freeMem result params' <- peek params params'' <- (wrapPtr Soup.XMLRPCParams.XMLRPCParams) params' freeMem methodCall' freeMem params return (result', params'') ) (do freeMem methodCall' freeMem params ) -- function soup_xmlrpc_parse_method_response -- Args : [Arg {argCName = "method_response", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the XML-RPC methodResponse string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @method_response, or -1 if it is NUL-terminated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "on return, the return value from @method_call", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "soup_xmlrpc_parse_method_response" soup_xmlrpc_parse_method_response :: CString -> -- method_response : TBasicType TUTF8 Int32 -> -- length : TBasicType TInt Ptr GValue -> -- value : TInterface (Name {namespace = "GObject", name = "Value"}) Ptr (Ptr GError) -> -- error IO CInt {-# DEPRECATED xmlrpcParseMethodResponse ["Use 'GI.Soup.Functions.xmlrpcParseResponse' instead."] #-} {- | Parses /@methodResponse@/ and returns the return value in /@value@/. If /@methodResponse@/ is a fault, /@value@/ will be unchanged, and /@error@/ will be set to an error of type @/SOUP_XMLRPC_FAULT/@, with the error @/code/@ containing the fault code, and the error @/message/@ containing the fault string. (If /@methodResponse@/ cannot be parsed at all, 'GI.Soup.Functions.xmlrpcParseMethodResponse' will return 'False', but /@error@/ will be unset.) -} xmlrpcParseMethodResponse :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@methodResponse@/: the XML-RPC methodResponse string -} -> Int32 {- ^ /@length@/: the length of /@methodResponse@/, or -1 if it is NUL-terminated -} -> m (GValue) {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} xmlrpcParseMethodResponse methodResponse length_ = liftIO $ do methodResponse' <- textToCString methodResponse value <- callocBoxedBytes 24 :: IO (Ptr GValue) onException (do _ <- propagateGError $ soup_xmlrpc_parse_method_response methodResponse' length_ value value' <- (wrapBoxed GValue) value freeMem methodResponse' return value' ) (do freeMem methodResponse' freeMem value ) -- function soup_xmlrpc_parse_method_call -- Args : [Arg {argCName = "method_call", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the XML-RPC methodCall string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @method_call, or -1 if it is NUL-terminated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "method_name", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "on return, the methodName from @method_call", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "params", argType = TInterface (Name {namespace = "GObject", name = "ValueArray"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "on return, the parameters from @method_call", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "soup_xmlrpc_parse_method_call" soup_xmlrpc_parse_method_call :: CString -> -- method_call : TBasicType TUTF8 Int32 -> -- length : TBasicType TInt Ptr CString -> -- method_name : TBasicType TUTF8 Ptr (Ptr GObject.ValueArray.ValueArray) -> -- params : TInterface (Name {namespace = "GObject", name = "ValueArray"}) IO CInt {-# DEPRECATED xmlrpcParseMethodCall ["Use @/soup_xmlrpc_parse_request_full()/@ instead."] #-} {- | Parses /@methodCall@/ to get the name and parameters, and returns the parameter values in a 'GI.GObject.Structs.ValueArray.ValueArray'; see also @/soup_xmlrpc_extract_method_call()/@, which is more convenient if you know in advance what the types of the parameters will be. -} xmlrpcParseMethodCall :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@methodCall@/: the XML-RPC methodCall string -} -> Int32 {- ^ /@length@/: the length of /@methodCall@/, or -1 if it is NUL-terminated -} -> m ((Bool, T.Text, GObject.ValueArray.ValueArray)) {- ^ __Returns:__ success or failure. -} xmlrpcParseMethodCall methodCall length_ = liftIO $ do methodCall' <- textToCString methodCall methodName <- allocMem :: IO (Ptr CString) params <- allocMem :: IO (Ptr (Ptr GObject.ValueArray.ValueArray)) result <- soup_xmlrpc_parse_method_call methodCall' length_ methodName params let result' = (/= 0) result methodName' <- peek methodName methodName'' <- cstringToText methodName' freeMem methodName' params' <- peek params params'' <- (wrapBoxed GObject.ValueArray.ValueArray) params' freeMem methodCall' freeMem methodName freeMem params return (result', methodName'', params'') -- function soup_xmlrpc_message_set_response -- Args : [Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an XML-RPC request", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TVariant, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GVariant", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "soup_xmlrpc_message_set_response" soup_xmlrpc_message_set_response :: Ptr Soup.Message.Message -> -- msg : TInterface (Name {namespace = "Soup", name = "Message"}) Ptr GVariant -> -- value : TVariant Ptr (Ptr GError) -> -- error IO CInt {- | Sets the status code and response body of /@msg@/ to indicate a successful XML-RPC call, with a return value given by /@value@/. To set a fault response, use @/soup_xmlrpc_message_set_fault()/@. See 'GI.Soup.Functions.xmlrpcBuildRequest' for serialization details. If /@value@/ is floating, it is consumed. /Since: 2.52/ -} xmlrpcMessageSetResponse :: (B.CallStack.HasCallStack, MonadIO m, Soup.Message.IsMessage a) => a {- ^ /@msg@/: an XML-RPC request -} -> GVariant {- ^ /@value@/: a 'GVariant' -} -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} xmlrpcMessageSetResponse msg value = liftIO $ do msg' <- unsafeManagedPtrCastPtr msg value' <- unsafeManagedPtrGetPtr value onException (do _ <- propagateGError $ soup_xmlrpc_message_set_response msg' value' touchManagedPtr msg touchManagedPtr value return () ) (do return () ) -- function soup_xmlrpc_message_new -- Args : [Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "URI of the XML-RPC service", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "method_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the XML-RPC method to invoke at @uri", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "params", argType = TVariant, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GVariant tuple", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Soup", name = "Message"})) -- throws : True -- Skip return : False foreign import ccall "soup_xmlrpc_message_new" soup_xmlrpc_message_new :: CString -> -- uri : TBasicType TUTF8 CString -> -- method_name : TBasicType TUTF8 Ptr GVariant -> -- params : TVariant Ptr (Ptr GError) -> -- error IO (Ptr Soup.Message.Message) {- | Creates an XML-RPC methodCall and returns a 'GI.Soup.Objects.Message.Message', ready to send, for that method call. See 'GI.Soup.Functions.xmlrpcBuildRequest' for serialization details. If /@params@/ is floating, it is consumed. /Since: 2.52/ -} xmlrpcMessageNew :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@uri@/: URI of the XML-RPC service -} -> T.Text {- ^ /@methodName@/: the name of the XML-RPC method to invoke at /@uri@/ -} -> GVariant {- ^ /@params@/: a 'GVariant' tuple -} -> m Soup.Message.Message {- ^ __Returns:__ a 'GI.Soup.Objects.Message.Message' encoding the indicated XML-RPC request, or 'Nothing' on error. /(Can throw 'Data.GI.Base.GError.GError')/ -} xmlrpcMessageNew uri methodName params = liftIO $ do uri' <- textToCString uri methodName' <- textToCString methodName params' <- unsafeManagedPtrGetPtr params onException (do result <- propagateGError $ soup_xmlrpc_message_new uri' methodName' params' checkUnexpectedReturnNULL "xmlrpcMessageNew" result result' <- (wrapObject Soup.Message.Message) result touchManagedPtr params freeMem uri' freeMem methodName' return result' ) (do freeMem uri' freeMem methodName' ) -- function soup_xmlrpc_build_response -- Args : [Arg {argCName = "value", argType = TVariant, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the return value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUTF8) -- throws : True -- Skip return : False foreign import ccall "soup_xmlrpc_build_response" soup_xmlrpc_build_response :: Ptr GVariant -> -- value : TVariant Ptr (Ptr GError) -> -- error IO CString {- | This creates a (successful) XML-RPC methodResponse and returns it as a string. To create a fault response, use @/soup_xmlrpc_build_fault()/@. This is the low-level method that 'GI.Soup.Functions.xmlrpcMessageSetResponse' is built on. See 'GI.Soup.Functions.xmlrpcBuildRequest' for serialization details, but note that since a method can only have a single return value, /@value@/ should not be a tuple here (unless the return value is an array). If /@value@/ is floating, it is consumed. /Since: 2.52/ -} xmlrpcBuildResponse :: (B.CallStack.HasCallStack, MonadIO m) => GVariant {- ^ /@value@/: the return value -} -> m T.Text {- ^ __Returns:__ the text of the methodResponse, or 'Nothing' on error. /(Can throw 'Data.GI.Base.GError.GError')/ -} xmlrpcBuildResponse value = liftIO $ do value' <- unsafeManagedPtrGetPtr value onException (do result <- propagateGError $ soup_xmlrpc_build_response value' checkUnexpectedReturnNULL "xmlrpcBuildResponse" result result' <- cstringToText result freeMem result touchManagedPtr value return result' ) (do return () ) -- function soup_xmlrpc_build_request -- Args : [Arg {argCName = "method_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the XML-RPC method", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "params", argType = TVariant, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GVariant tuple", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUTF8) -- throws : True -- Skip return : False foreign import ccall "soup_xmlrpc_build_request" soup_xmlrpc_build_request :: CString -> -- method_name : TBasicType TUTF8 Ptr GVariant -> -- params : TVariant Ptr (Ptr GError) -> -- error IO CString {- | This creates an XML-RPC methodCall and returns it as a string. This is the low-level method that 'GI.Soup.Functions.xmlrpcMessageNew' is built on. /@params@/ is a 'GVariant' tuple representing the method parameters. Serialization details: - \"a{s*}\" and \"{s*}\" are serialized as <struct> - \"ay\" is serialized as <base64> - Other arrays and tuples are serialized as <array> - booleans are serialized as <boolean> - byte, int16, uint16 and int32 are serialized as <int> - uint32 and int64 are serialized as the nonstandard <i8> type - doubles are serialized as <double> - Strings are serialized as <string> - Variants (i.e. \"v\" type) are unwrapped and their child is serialized. - @/GVariants/@ created by 'GI.Soup.Functions.xmlrpcVariantNewDatetime' are serialized as <dateTime.iso8601> - Other types are not supported and will return 'Nothing' and set /@error@/. This notably includes: object-paths, signatures, uint64, handles, maybes and dictionaries with non-string keys. If /@params@/ is floating, it is consumed. /Since: 2.52/ -} xmlrpcBuildRequest :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@methodName@/: the name of the XML-RPC method -} -> GVariant {- ^ /@params@/: a 'GVariant' tuple -} -> m T.Text {- ^ __Returns:__ the text of the methodCall, or 'Nothing' on error. /(Can throw 'Data.GI.Base.GError.GError')/ -} xmlrpcBuildRequest methodName params = liftIO $ do methodName' <- textToCString methodName params' <- unsafeManagedPtrGetPtr params onException (do result <- propagateGError $ soup_xmlrpc_build_request methodName' params' checkUnexpectedReturnNULL "xmlrpcBuildRequest" result result' <- cstringToText result freeMem result touchManagedPtr params freeMem methodName' return result' ) (do freeMem methodName' ) -- function soup_xmlrpc_build_method_response -- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the return value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "soup_xmlrpc_build_method_response" soup_xmlrpc_build_method_response :: Ptr GValue -> -- value : TInterface (Name {namespace = "GObject", name = "Value"}) IO CString {-# DEPRECATED xmlrpcBuildMethodResponse ["Use 'GI.Soup.Functions.xmlrpcBuildResponse' instead."] #-} {- | This creates a (successful) XML-RPC methodResponse and returns it as a string. To create a fault response, use @/soup_xmlrpc_build_fault()/@. The glib type to XML-RPC type mapping is as with 'GI.Soup.Functions.xmlrpcBuildMethodCall', qv. -} xmlrpcBuildMethodResponse :: (B.CallStack.HasCallStack, MonadIO m) => GValue {- ^ /@value@/: the return value -} -> m (Maybe T.Text) {- ^ __Returns:__ the text of the methodResponse, or 'Nothing' on error -} xmlrpcBuildMethodResponse value = liftIO $ do value' <- unsafeManagedPtrGetPtr value result <- soup_xmlrpc_build_method_response value' maybeResult <- convertIfNonNull result $ \result' -> do result'' <- cstringToText result' freeMem result' return result'' touchManagedPtr value return maybeResult -- function soup_xmlrpc_build_method_call -- Args : [Arg {argCName = "method_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the XML-RPC method", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "params", argType = TCArray False (-1) 2 (TInterface (Name {namespace = "GObject", name = "Value"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "arguments to @method", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_params", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "length of @params", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [Arg {argCName = "n_params", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "length of @params", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- returnType : Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "soup_xmlrpc_build_method_call" soup_xmlrpc_build_method_call :: CString -> -- method_name : TBasicType TUTF8 Ptr GValue -> -- params : TCArray False (-1) 2 (TInterface (Name {namespace = "GObject", name = "Value"})) Int32 -> -- n_params : TBasicType TInt IO CString {-# DEPRECATED xmlrpcBuildMethodCall ["Use 'GI.Soup.Functions.xmlrpcBuildRequest' instead."] #-} {- | This creates an XML-RPC methodCall and returns it as a string. This is the low-level method that @/soup_xmlrpc_request_new()/@ is built on. /@params@/ is an array of 'GI.GObject.Structs.Value.Value' representing the parameters to /@method@/. (It is *not* a 'GI.GObject.Structs.ValueArray.ValueArray', although if you have a 'GI.GObject.Structs.ValueArray.ValueArray', you can just pass its \<literal>values\<\/literal>f and \<literal>n_values\<\/literal> fields.) The correspondence between glib types and XML-RPC types is: int: @/int/@ (@/G_TYPE_INT/@) boolean: 'Bool' (@/G_TYPE_BOOLEAN/@) string: @/char/@* (@/G_TYPE_STRING/@) double: @/double/@ (@/G_TYPE_DOUBLE/@) datetime.iso8601: 'GI.Soup.Structs.Date.Date' (@/SOUP_TYPE_DATE/@) base64: 'GI.GLib.Structs.ByteArray.ByteArray' (@/SOUP_TYPE_BYTE_ARRAY/@) struct: 'GI.GLib.Structs.HashTable.HashTable' (@/G_TYPE_HASH_TABLE/@) array: 'GI.GObject.Structs.ValueArray.ValueArray' (@/G_TYPE_VALUE_ARRAY/@) For structs, use a 'GI.GLib.Structs.HashTable.HashTable' that maps strings to 'GI.GObject.Structs.Value.Value'; 'GI.Soup.Functions.valueHashNew' and related methods can help with this. -} xmlrpcBuildMethodCall :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@methodName@/: the name of the XML-RPC method -} -> [GValue] {- ^ /@params@/: arguments to /@method@/ -} -> m (Maybe T.Text) {- ^ __Returns:__ the text of the methodCall, or 'Nothing' on error -} xmlrpcBuildMethodCall methodName params = liftIO $ do let nParams = fromIntegral $ length params methodName' <- textToCString methodName params' <- mapM unsafeManagedPtrGetPtr params params'' <- packBlockArray 24 params' result <- soup_xmlrpc_build_method_call methodName' params'' nParams maybeResult <- convertIfNonNull result $ \result' -> do result'' <- cstringToText result' freeMem result' return result'' mapM_ touchManagedPtr params freeMem methodName' freeMem params'' return maybeResult -- function soup_websocket_server_process_handshake -- Args : [Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#SoupMessage containing the client side of a WebSocket handshake", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "expected_origin", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "expected Origin header", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "protocols", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "allowed WebSocket\n protocols.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "soup_websocket_server_process_handshake" soup_websocket_server_process_handshake :: Ptr Soup.Message.Message -> -- msg : TInterface (Name {namespace = "Soup", name = "Message"}) CString -> -- expected_origin : TBasicType TUTF8 Ptr CString -> -- protocols : TCArray True (-1) (-1) (TBasicType TUTF8) IO CInt {- | Examines the method and request headers in /@msg@/ and (assuming /@msg@/ contains a valid handshake request), fills in the handshake response. If /@expectedOrigin@/ is non-'Nothing', then only requests containing a matching \"Origin\" header will be accepted. If /@protocols@/ is non-'Nothing', then only requests containing a compatible \"Sec-WebSocket-Protocols\" header will be accepted. This is a low-level function; if you use 'GI.Soup.Objects.Server.serverAddWebsocketHandler' to handle accepting WebSocket connections, it will call this for you. /Since: 2.50/ -} websocketServerProcessHandshake :: (B.CallStack.HasCallStack, MonadIO m, Soup.Message.IsMessage a) => a {- ^ /@msg@/: 'GI.Soup.Objects.Message.Message' containing the client side of a WebSocket handshake -} -> Maybe (T.Text) {- ^ /@expectedOrigin@/: expected Origin header -} -> Maybe ([T.Text]) {- ^ /@protocols@/: allowed WebSocket protocols. -} -> m Bool {- ^ __Returns:__ 'True' if /@msg@/ contained a valid WebSocket handshake request and was updated to contain a handshake response. 'False' if not. -} websocketServerProcessHandshake msg expectedOrigin protocols = liftIO $ do msg' <- unsafeManagedPtrCastPtr msg maybeExpectedOrigin <- case expectedOrigin of Nothing -> return nullPtr Just jExpectedOrigin -> do jExpectedOrigin' <- textToCString jExpectedOrigin return jExpectedOrigin' maybeProtocols <- case protocols of Nothing -> return nullPtr Just jProtocols -> do jProtocols' <- packZeroTerminatedUTF8CArray jProtocols return jProtocols' result <- soup_websocket_server_process_handshake msg' maybeExpectedOrigin maybeProtocols let result' = (/= 0) result touchManagedPtr msg freeMem maybeExpectedOrigin mapZeroTerminatedCArray freeMem maybeProtocols freeMem maybeProtocols return result' -- function soup_websocket_server_check_handshake -- Args : [Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#SoupMessage containing the client side of a WebSocket handshake", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "origin", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "expected Origin header", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "protocols", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "allowed WebSocket\n protocols.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "soup_websocket_server_check_handshake" soup_websocket_server_check_handshake :: Ptr Soup.Message.Message -> -- msg : TInterface (Name {namespace = "Soup", name = "Message"}) CString -> -- origin : TBasicType TUTF8 Ptr CString -> -- protocols : TCArray True (-1) (-1) (TBasicType TUTF8) Ptr (Ptr GError) -> -- error IO CInt {- | Examines the method and request headers in /@msg@/ and determines whether /@msg@/ contains a valid handshake request. If /@origin@/ is non-'Nothing', then only requests containing a matching \"Origin\" header will be accepted. If /@protocols@/ is non-'Nothing', then only requests containing a compatible \"Sec-WebSocket-Protocols\" header will be accepted. Normally 'GI.Soup.Functions.websocketServerProcessHandshake' will take care of this for you, and if you use 'GI.Soup.Objects.Server.serverAddWebsocketHandler' to handle accepting WebSocket connections, it will call that for you. However, this function may be useful if you need to perform more complicated validation; eg, accepting multiple different Origins, or handling different protocols depending on the path. /Since: 2.50/ -} websocketServerCheckHandshake :: (B.CallStack.HasCallStack, MonadIO m, Soup.Message.IsMessage a) => a {- ^ /@msg@/: 'GI.Soup.Objects.Message.Message' containing the client side of a WebSocket handshake -} -> Maybe (T.Text) {- ^ /@origin@/: expected Origin header -} -> Maybe ([T.Text]) {- ^ /@protocols@/: allowed WebSocket protocols. -} -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} websocketServerCheckHandshake msg origin protocols = liftIO $ do msg' <- unsafeManagedPtrCastPtr msg maybeOrigin <- case origin of Nothing -> return nullPtr Just jOrigin -> do jOrigin' <- textToCString jOrigin return jOrigin' maybeProtocols <- case protocols of Nothing -> return nullPtr Just jProtocols -> do jProtocols' <- packZeroTerminatedUTF8CArray jProtocols return jProtocols' onException (do _ <- propagateGError $ soup_websocket_server_check_handshake msg' maybeOrigin maybeProtocols touchManagedPtr msg freeMem maybeOrigin mapZeroTerminatedCArray freeMem maybeProtocols freeMem maybeProtocols return () ) (do freeMem maybeOrigin mapZeroTerminatedCArray freeMem maybeProtocols freeMem maybeProtocols ) -- function soup_websocket_client_verify_handshake -- Args : [Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#SoupMessage containing both client and server sides of a\n WebSocket handshake", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "soup_websocket_client_verify_handshake" soup_websocket_client_verify_handshake :: Ptr Soup.Message.Message -> -- msg : TInterface (Name {namespace = "Soup", name = "Message"}) Ptr (Ptr GError) -> -- error IO CInt {- | Looks at the response status code and headers in /@msg@/ and determines if they contain a valid WebSocket handshake response (given the handshake request in /@msg@/\'s request headers). This is a low-level function; if you use 'GI.Soup.Objects.Session.sessionWebsocketConnectAsync' to create a WebSocket connection, it will call this for you. /Since: 2.50/ -} websocketClientVerifyHandshake :: (B.CallStack.HasCallStack, MonadIO m, Soup.Message.IsMessage a) => a {- ^ /@msg@/: 'GI.Soup.Objects.Message.Message' containing both client and server sides of a WebSocket handshake -} -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} websocketClientVerifyHandshake msg = liftIO $ do msg' <- unsafeManagedPtrCastPtr msg onException (do _ <- propagateGError $ soup_websocket_client_verify_handshake msg' touchManagedPtr msg return () ) (do return () ) -- function soup_websocket_client_prepare_handshake -- Args : [Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMessage", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "origin", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the \"Origin\" header to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "protocols", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "list of\n protocols to offer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "soup_websocket_client_prepare_handshake" soup_websocket_client_prepare_handshake :: Ptr Soup.Message.Message -> -- msg : TInterface (Name {namespace = "Soup", name = "Message"}) CString -> -- origin : TBasicType TUTF8 Ptr CString -> -- protocols : TCArray True (-1) (-1) (TBasicType TUTF8) IO () {- | Adds the necessary headers to /@msg@/ to request a WebSocket handshake. The message body and non-WebSocket-related headers are not modified. This is a low-level function; if you use 'GI.Soup.Objects.Session.sessionWebsocketConnectAsync' to create a WebSocket connection, it will call this for you. /Since: 2.50/ -} websocketClientPrepareHandshake :: (B.CallStack.HasCallStack, MonadIO m, Soup.Message.IsMessage a) => a {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -} -> Maybe (T.Text) {- ^ /@origin@/: the \"Origin\" header to set -} -> Maybe ([T.Text]) {- ^ /@protocols@/: list of protocols to offer -} -> m () websocketClientPrepareHandshake msg origin protocols = liftIO $ do msg' <- unsafeManagedPtrCastPtr msg maybeOrigin <- case origin of Nothing -> return nullPtr Just jOrigin -> do jOrigin' <- textToCString jOrigin return jOrigin' maybeProtocols <- case protocols of Nothing -> return nullPtr Just jProtocols -> do jProtocols' <- packZeroTerminatedUTF8CArray jProtocols return jProtocols' soup_websocket_client_prepare_handshake msg' maybeOrigin maybeProtocols touchManagedPtr msg freeMem maybeOrigin mapZeroTerminatedCArray freeMem maybeProtocols freeMem maybeProtocols return () -- function soup_value_hash_new -- XXX Could not generate function soup_value_hash_new -- Error was : Not implemented: "GHashTable element of type TInterface (Name {namespace = \"GObject\", name = \"Value\"}) unsupported." -- function soup_value_hash_insert_value -- XXX Could not generate function soup_value_hash_insert_value -- Error was : Not implemented: "GHashTable element of type TInterface (Name {namespace = \"GObject\", name = \"Value\"}) unsupported." -- function soup_value_array_new -- Args : [] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "GObject", name = "ValueArray"})) -- throws : False -- Skip return : False foreign import ccall "soup_value_array_new" soup_value_array_new :: IO (Ptr GObject.ValueArray.ValueArray) {-# DEPRECATED valueArrayNew ["Use 'GVariant' API instead."] #-} {- | Creates a new @/GValueArray/@. (This is just a wrapper around 'GI.GObject.Structs.ValueArray.valueArrayNew', for naming consistency purposes.) -} valueArrayNew :: (B.CallStack.HasCallStack, MonadIO m) => m GObject.ValueArray.ValueArray {- ^ __Returns:__ a new @/GValueArray/@ -} valueArrayNew = liftIO $ do result <- soup_value_array_new checkUnexpectedReturnNULL "valueArrayNew" result result' <- (wrapBoxed GObject.ValueArray.ValueArray) result return result' -- function soup_tld_get_base_domain -- Args : [Arg {argCName = "hostname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a hostname", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUTF8) -- throws : True -- Skip return : False foreign import ccall "soup_tld_get_base_domain" soup_tld_get_base_domain :: CString -> -- hostname : TBasicType TUTF8 Ptr (Ptr GError) -> -- error IO CString {- | Finds the base domain for a given /@hostname@/. The base domain is composed by the top level domain (such as .org, .com, .co.uk, etc) plus the second level domain, for example for myhost.mydomain.com it will return mydomain.com. Note that 'Nothing' will be returned for private URLs (those not ending with any well known TLD) because choosing a base domain for them would be totally arbitrary. Prior to libsoup 2.46, this function required that /@hostname@/ be in UTF-8 if it was an IDN. From 2.46 on, the name can be in either UTF-8 or ASCII format (and the return value will be in the same format). /Since: 2.40/ -} tldGetBaseDomain :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@hostname@/: a hostname -} -> m T.Text {- ^ __Returns:__ a pointer to the start of the base domain in /@hostname@/. If an error occurs, 'Nothing' will be returned and /@error@/ set. /(Can throw 'Data.GI.Base.GError.GError')/ -} tldGetBaseDomain hostname = liftIO $ do hostname' <- textToCString hostname onException (do result <- propagateGError $ soup_tld_get_base_domain hostname' checkUnexpectedReturnNULL "tldGetBaseDomain" result result' <- cstringToText result freeMem hostname' return result' ) (do freeMem hostname' ) -- function soup_tld_domain_is_public_suffix -- Args : [Arg {argCName = "domain", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a domain name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "soup_tld_domain_is_public_suffix" soup_tld_domain_is_public_suffix :: CString -> -- domain : TBasicType TUTF8 IO CInt {- | Looks whether the /@domain@/ passed as argument is a public domain suffix (.org, .com, .co.uk, etc) or not. Prior to libsoup 2.46, this function required that /@domain@/ be in UTF-8 if it was an IDN. From 2.46 on, the name can be in either UTF-8 or ASCII format. /Since: 2.40/ -} tldDomainIsPublicSuffix :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@domain@/: a domain name -} -> m Bool {- ^ __Returns:__ 'True' if it is a public domain, 'False' otherwise. -} tldDomainIsPublicSuffix domain = liftIO $ do domain' <- textToCString domain result <- soup_tld_domain_is_public_suffix domain' let result' = (/= 0) result freeMem domain' return result' -- function soup_str_case_hash -- Args : [Arg {argCName = "key", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "ASCII string to hash", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUInt) -- throws : False -- Skip return : False foreign import ccall "soup_str_case_hash" soup_str_case_hash :: Ptr () -> -- key : TBasicType TPtr IO Word32 {- | Hashes /@key@/ in a case-insensitive manner. -} strCaseHash :: (B.CallStack.HasCallStack, MonadIO m) => Ptr () {- ^ /@key@/: ASCII string to hash -} -> m Word32 {- ^ __Returns:__ the hash code. -} strCaseHash key = liftIO $ do result <- soup_str_case_hash key return result -- function soup_str_case_equal -- Args : [Arg {argCName = "v1", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "an ASCII string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "v2", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "another ASCII string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "soup_str_case_equal" soup_str_case_equal :: Ptr () -> -- v1 : TBasicType TPtr Ptr () -> -- v2 : TBasicType TPtr IO CInt {- | Compares /@v1@/ and /@v2@/ in a case-insensitive manner -} strCaseEqual :: (B.CallStack.HasCallStack, MonadIO m) => Ptr () {- ^ /@v1@/: an ASCII string -} -> Ptr () {- ^ /@v2@/: another ASCII string -} -> m Bool {- ^ __Returns:__ 'True' if they are equal (modulo case) -} strCaseEqual v1 v2 = liftIO $ do result <- soup_str_case_equal v1 v2 let result' = (/= 0) result return result' -- function soup_http_error_quark -- Args : [] -- Lengths : [] -- returnType : Just (TBasicType TUInt32) -- throws : False -- Skip return : False foreign import ccall "soup_http_error_quark" soup_http_error_quark :: IO Word32 {- | /No description available in the introspection data./ -} httpErrorQuark :: (B.CallStack.HasCallStack, MonadIO m) => m Word32 httpErrorQuark = liftIO $ do result <- soup_http_error_quark return result -- function soup_headers_parse_status_line -- Args : [Arg {argCName = "status_line", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an HTTP Status-Line", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "ver", argType = TInterface (Name {namespace = "Soup", name = "HTTPVersion"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if non-%NULL, will be filled in with the HTTP\nversion", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "status_code", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if non-%NULL, will be filled in with\nthe status code", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "reason_phrase", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if non-%NULL, will be filled in with\nthe reason phrase", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "soup_headers_parse_status_line" soup_headers_parse_status_line :: CString -> -- status_line : TBasicType TUTF8 Ptr CUInt -> -- ver : TInterface (Name {namespace = "Soup", name = "HTTPVersion"}) Ptr Word32 -> -- status_code : TBasicType TUInt Ptr CString -> -- reason_phrase : TBasicType TUTF8 IO CInt {- | Parses the HTTP Status-Line string in /@statusLine@/ into /@ver@/, /@statusCode@/, and /@reasonPhrase@/. /@statusLine@/ must be terminated by either \"\\0\" or \"\\r\\n\". -} headersParseStatusLine :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@statusLine@/: an HTTP Status-Line -} -> m ((Bool, Soup.Enums.HTTPVersion, Word32, T.Text)) {- ^ __Returns:__ 'True' if /@statusLine@/ was parsed successfully. -} headersParseStatusLine statusLine = liftIO $ do statusLine' <- textToCString statusLine ver <- allocMem :: IO (Ptr CUInt) statusCode <- allocMem :: IO (Ptr Word32) reasonPhrase <- allocMem :: IO (Ptr CString) result <- soup_headers_parse_status_line statusLine' ver statusCode reasonPhrase let result' = (/= 0) result ver' <- peek ver let ver'' = (toEnum . fromIntegral) ver' statusCode' <- peek statusCode reasonPhrase' <- peek reasonPhrase reasonPhrase'' <- cstringToText reasonPhrase' freeMem reasonPhrase' freeMem statusLine' freeMem ver freeMem statusCode freeMem reasonPhrase return (result', ver'', statusCode', reasonPhrase'') -- function soup_headers_parse_response -- Args : [Arg {argCName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the headers (up to, but not including, the trailing blank line)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "len", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "length of @str", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "headers", argType = TInterface (Name {namespace = "Soup", name = "MessageHeaders"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#SoupMessageHeaders to store the header values in", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "ver", argType = TInterface (Name {namespace = "Soup", name = "HTTPVersion"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if non-%NULL, will be filled in with the HTTP\nversion", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "status_code", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if non-%NULL, will be filled in with\nthe status code", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "reason_phrase", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if non-%NULL, will be filled in with\nthe reason phrase", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "soup_headers_parse_response" soup_headers_parse_response :: CString -> -- str : TBasicType TUTF8 Int32 -> -- len : TBasicType TInt Ptr Soup.MessageHeaders.MessageHeaders -> -- headers : TInterface (Name {namespace = "Soup", name = "MessageHeaders"}) Ptr CUInt -> -- ver : TInterface (Name {namespace = "Soup", name = "HTTPVersion"}) Ptr Word32 -> -- status_code : TBasicType TUInt Ptr CString -> -- reason_phrase : TBasicType TUTF8 IO CInt {- | Parses the headers of an HTTP response in /@str@/ and stores the results in /@ver@/, /@statusCode@/, /@reasonPhrase@/, and /@headers@/. Beware that /@headers@/ may be modified even on failure. -} headersParseResponse :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@str@/: the headers (up to, but not including, the trailing blank line) -} -> Int32 {- ^ /@len@/: length of /@str@/ -} -> Soup.MessageHeaders.MessageHeaders {- ^ /@headers@/: 'GI.Soup.Structs.MessageHeaders.MessageHeaders' to store the header values in -} -> m ((Bool, Soup.Enums.HTTPVersion, Word32, T.Text)) {- ^ __Returns:__ success or failure. -} headersParseResponse str len headers = liftIO $ do str' <- textToCString str headers' <- unsafeManagedPtrGetPtr headers ver <- allocMem :: IO (Ptr CUInt) statusCode <- allocMem :: IO (Ptr Word32) reasonPhrase <- allocMem :: IO (Ptr CString) result <- soup_headers_parse_response str' len headers' ver statusCode reasonPhrase let result' = (/= 0) result ver' <- peek ver let ver'' = (toEnum . fromIntegral) ver' statusCode' <- peek statusCode reasonPhrase' <- peek reasonPhrase reasonPhrase'' <- cstringToText reasonPhrase' freeMem reasonPhrase' touchManagedPtr headers freeMem str' freeMem ver freeMem statusCode freeMem reasonPhrase return (result', ver'', statusCode', reasonPhrase'') -- function soup_headers_parse_request -- Args : [Arg {argCName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the headers (up to, but not including, the trailing blank line)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "len", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "length of @str", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "req_headers", argType = TInterface (Name {namespace = "Soup", name = "MessageHeaders"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#SoupMessageHeaders to store the header values in", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "req_method", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if non-%NULL, will be filled in with the\nrequest method", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "req_path", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if non-%NULL, will be filled in with the\nrequest path", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "ver", argType = TInterface (Name {namespace = "Soup", name = "HTTPVersion"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if non-%NULL, will be filled in with the HTTP\nversion", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Just (TBasicType TUInt) -- throws : False -- Skip return : False foreign import ccall "soup_headers_parse_request" soup_headers_parse_request :: CString -> -- str : TBasicType TUTF8 Int32 -> -- len : TBasicType TInt Ptr Soup.MessageHeaders.MessageHeaders -> -- req_headers : TInterface (Name {namespace = "Soup", name = "MessageHeaders"}) Ptr CString -> -- req_method : TBasicType TUTF8 Ptr CString -> -- req_path : TBasicType TUTF8 Ptr CUInt -> -- ver : TInterface (Name {namespace = "Soup", name = "HTTPVersion"}) IO Word32 {- | Parses the headers of an HTTP request in /@str@/ and stores the results in /@reqMethod@/, /@reqPath@/, /@ver@/, and /@reqHeaders@/. Beware that /@reqHeaders@/ may be modified even on failure. -} headersParseRequest :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@str@/: the headers (up to, but not including, the trailing blank line) -} -> Int32 {- ^ /@len@/: length of /@str@/ -} -> Soup.MessageHeaders.MessageHeaders {- ^ /@reqHeaders@/: 'GI.Soup.Structs.MessageHeaders.MessageHeaders' to store the header values in -} -> m ((Word32, T.Text, T.Text, Soup.Enums.HTTPVersion)) {- ^ __Returns:__ 'GI.Soup.Enums.StatusOk' if the headers could be parsed, or an HTTP error to be returned to the client if they could not be. -} headersParseRequest str len reqHeaders = liftIO $ do str' <- textToCString str reqHeaders' <- unsafeManagedPtrGetPtr reqHeaders reqMethod <- allocMem :: IO (Ptr CString) reqPath <- allocMem :: IO (Ptr CString) ver <- allocMem :: IO (Ptr CUInt) result <- soup_headers_parse_request str' len reqHeaders' reqMethod reqPath ver reqMethod' <- peek reqMethod reqMethod'' <- cstringToText reqMethod' freeMem reqMethod' reqPath' <- peek reqPath reqPath'' <- cstringToText reqPath' freeMem reqPath' ver' <- peek ver let ver'' = (toEnum . fromIntegral) ver' touchManagedPtr reqHeaders freeMem str' freeMem reqMethod freeMem reqPath freeMem ver return (result, reqMethod'', reqPath'', ver'') -- function soup_headers_parse -- Args : [Arg {argCName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the header string (including the Request-Line or Status-Line,\n but not the trailing blank line)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "len", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "length of @str", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest", argType = TInterface (Name {namespace = "Soup", name = "MessageHeaders"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#SoupMessageHeaders to store the header values in", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "soup_headers_parse" soup_headers_parse :: CString -> -- str : TBasicType TUTF8 Int32 -> -- len : TBasicType TInt Ptr Soup.MessageHeaders.MessageHeaders -> -- dest : TInterface (Name {namespace = "Soup", name = "MessageHeaders"}) IO CInt {- | Parses the headers of an HTTP request or response in /@str@/ and stores the results in /@dest@/. Beware that /@dest@/ may be modified even on failure. This is a low-level method; normally you would use 'GI.Soup.Functions.headersParseRequest' or 'GI.Soup.Functions.headersParseResponse'. /Since: 2.26/ -} headersParse :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@str@/: the header string (including the Request-Line or Status-Line, but not the trailing blank line) -} -> Int32 {- ^ /@len@/: length of /@str@/ -} -> Soup.MessageHeaders.MessageHeaders {- ^ /@dest@/: 'GI.Soup.Structs.MessageHeaders.MessageHeaders' to store the header values in -} -> m Bool {- ^ __Returns:__ success or failure -} headersParse str len dest = liftIO $ do str' <- textToCString str dest' <- unsafeManagedPtrGetPtr dest result <- soup_headers_parse str' len dest' let result' = (/= 0) result touchManagedPtr dest freeMem str' return result' -- function soup_header_parse_semi_param_list_strict -- Args : [Arg {argCName = "header", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a header value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TGHash (TBasicType TUTF8) (TBasicType TUTF8)) -- throws : False -- Skip return : False foreign import ccall "soup_header_parse_semi_param_list_strict" soup_header_parse_semi_param_list_strict :: CString -> -- header : TBasicType TUTF8 IO (Ptr (GHashTable CString CString)) {- | A strict version of 'GI.Soup.Functions.headerParseSemiParamList' that bails out if there are duplicate parameters. Note that this function will treat RFC5987-encoded parameters as duplicated if an ASCII version is also present. For header fields that might contain RFC5987-encoded parameters, use 'GI.Soup.Functions.headerParseSemiParamList' instead. /Since: 2.66/ -} headerParseSemiParamListStrict :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@header@/: a header value -} -> m (Maybe (Map.Map T.Text T.Text)) {- ^ __Returns:__ a 'GI.GLib.Structs.HashTable.HashTable' of list elements, which can be freed with 'GI.Soup.Functions.headerFreeParamList' or 'Nothing' if there are duplicate elements. -} headerParseSemiParamListStrict header = liftIO $ do header' <- textToCString header result <- soup_header_parse_semi_param_list_strict header' maybeResult <- convertIfNonNull result $ \result' -> do result'' <- unpackGHashTable result' let result''' = mapFirst cstringUnpackPtr result'' result'''' <- mapFirstA cstringToText result''' let result''''' = mapSecond cstringUnpackPtr result'''' result'''''' <- mapSecondA cstringToText result''''' let result''''''' = Map.fromList result'''''' unrefGHashTable result' return result''''''' freeMem header' return maybeResult -- function soup_header_parse_semi_param_list -- Args : [Arg {argCName = "header", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a header value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TGHash (TBasicType TUTF8) (TBasicType TUTF8)) -- throws : False -- Skip return : False foreign import ccall "soup_header_parse_semi_param_list" soup_header_parse_semi_param_list :: CString -> -- header : TBasicType TUTF8 IO (Ptr (GHashTable CString CString)) {- | Parses a header which is a semicolon-delimited list of something like: \<literal>token [ \"=\" ( token | quoted-string ) ]\<\/literal>. Tokens that don\'t have an associated value will still be added to the resulting hash table, but with a 'Nothing' value. This also handles RFC5987 encoding (which in HTTP is mostly used for giving UTF8-encoded filenames in the Content-Disposition header). /Since: 2.24/ -} headerParseSemiParamList :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@header@/: a header value -} -> m (Map.Map T.Text T.Text) {- ^ __Returns:__ a 'GI.GLib.Structs.HashTable.HashTable' of list elements, which can be freed with 'GI.Soup.Functions.headerFreeParamList'. -} headerParseSemiParamList header = liftIO $ do header' <- textToCString header result <- soup_header_parse_semi_param_list header' checkUnexpectedReturnNULL "headerParseSemiParamList" result result' <- unpackGHashTable result let result'' = mapFirst cstringUnpackPtr result' result''' <- mapFirstA cstringToText result'' let result'''' = mapSecond cstringUnpackPtr result''' result''''' <- mapSecondA cstringToText result'''' let result'''''' = Map.fromList result''''' unrefGHashTable result freeMem header' return result'''''' -- function soup_header_parse_quality_list -- Args : [Arg {argCName = "header", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a header value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "unacceptable", argType = TGSList (TBasicType TUTF8), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "on\nreturn, will contain a list of unacceptable values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Just (TGSList (TBasicType TUTF8)) -- throws : False -- Skip return : False foreign import ccall "soup_header_parse_quality_list" soup_header_parse_quality_list :: CString -> -- header : TBasicType TUTF8 Ptr (Ptr (GSList CString)) -> -- unacceptable : TGSList (TBasicType TUTF8) IO (Ptr (GSList CString)) {- | Parses a header whose content is a list of items with optional \"qvalue\"s (eg, Accept, Accept-Charset, Accept-Encoding, Accept-Language, TE). If /@unacceptable@/ is not 'Nothing', then on return, it will contain the items with qvalue 0. Either way, those items will be removed from the main list. -} headerParseQualityList :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@header@/: a header value -} -> m (([T.Text], [T.Text])) {- ^ __Returns:__ a 'GI.GLib.Structs.SList.SList' of acceptable values (as allocated strings), highest-qvalue first. -} headerParseQualityList header = liftIO $ do header' <- textToCString header unacceptable <- allocMem :: IO (Ptr (Ptr (GSList CString))) result <- soup_header_parse_quality_list header' unacceptable result' <- unpackGSList result result'' <- mapM cstringToText result' mapGSList freeMem result g_slist_free result unacceptable' <- peek unacceptable unacceptable'' <- unpackGSList unacceptable' unacceptable''' <- mapM cstringToText unacceptable'' mapGSList freeMem unacceptable' g_slist_free unacceptable' freeMem header' freeMem unacceptable return (result'', unacceptable''') -- function soup_header_parse_param_list_strict -- Args : [Arg {argCName = "header", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a header value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TGHash (TBasicType TUTF8) (TBasicType TUTF8)) -- throws : False -- Skip return : False foreign import ccall "soup_header_parse_param_list_strict" soup_header_parse_param_list_strict :: CString -> -- header : TBasicType TUTF8 IO (Ptr (GHashTable CString CString)) {- | A strict version of 'GI.Soup.Functions.headerParseParamList' that bails out if there are duplicate parameters. Note that this function will treat RFC5987-encoded parameters as duplicated if an ASCII version is also present. For header fields that might contain RFC5987-encoded parameters, use 'GI.Soup.Functions.headerParseParamList' instead. /Since: 2.66/ -} headerParseParamListStrict :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@header@/: a header value -} -> m (Maybe (Map.Map T.Text T.Text)) {- ^ __Returns:__ a 'GI.GLib.Structs.HashTable.HashTable' of list elements, which can be freed with 'GI.Soup.Functions.headerFreeParamList' or 'Nothing' if there are duplicate elements. -} headerParseParamListStrict header = liftIO $ do header' <- textToCString header result <- soup_header_parse_param_list_strict header' maybeResult <- convertIfNonNull result $ \result' -> do result'' <- unpackGHashTable result' let result''' = mapFirst cstringUnpackPtr result'' result'''' <- mapFirstA cstringToText result''' let result''''' = mapSecond cstringUnpackPtr result'''' result'''''' <- mapSecondA cstringToText result''''' let result''''''' = Map.fromList result'''''' unrefGHashTable result' return result''''''' freeMem header' return maybeResult -- function soup_header_parse_param_list -- Args : [Arg {argCName = "header", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a header value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TGHash (TBasicType TUTF8) (TBasicType TUTF8)) -- throws : False -- Skip return : False foreign import ccall "soup_header_parse_param_list" soup_header_parse_param_list :: CString -> -- header : TBasicType TUTF8 IO (Ptr (GHashTable CString CString)) {- | Parses a header which is a comma-delimited list of something like: \<literal>token [ \"=\" ( token | quoted-string ) ]\<\/literal>. Tokens that don\'t have an associated value will still be added to the resulting hash table, but with a 'Nothing' value. This also handles RFC5987 encoding (which in HTTP is mostly used for giving UTF8-encoded filenames in the Content-Disposition header). -} headerParseParamList :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@header@/: a header value -} -> m (Map.Map T.Text T.Text) {- ^ __Returns:__ a 'GI.GLib.Structs.HashTable.HashTable' of list elements, which can be freed with 'GI.Soup.Functions.headerFreeParamList'. -} headerParseParamList header = liftIO $ do header' <- textToCString header result <- soup_header_parse_param_list header' checkUnexpectedReturnNULL "headerParseParamList" result result' <- unpackGHashTable result let result'' = mapFirst cstringUnpackPtr result' result''' <- mapFirstA cstringToText result'' let result'''' = mapSecond cstringUnpackPtr result''' result''''' <- mapSecondA cstringToText result'''' let result'''''' = Map.fromList result''''' unrefGHashTable result freeMem header' return result'''''' -- function soup_header_parse_list -- Args : [Arg {argCName = "header", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a header value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TGSList (TBasicType TUTF8)) -- throws : False -- Skip return : False foreign import ccall "soup_header_parse_list" soup_header_parse_list :: CString -> -- header : TBasicType TUTF8 IO (Ptr (GSList CString)) {- | Parses a header whose content is described by RFC2616 as \"@/something/@\", where \"something\" does not itself contain commas, except as part of quoted-strings. -} headerParseList :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@header@/: a header value -} -> m [T.Text] {- ^ __Returns:__ a 'GI.GLib.Structs.SList.SList' of list elements, as allocated strings -} headerParseList header = liftIO $ do header' <- textToCString header result <- soup_header_parse_list header' result' <- unpackGSList result result'' <- mapM cstringToText result' mapGSList freeMem result g_slist_free result freeMem header' return result'' -- function soup_header_g_string_append_param_quoted -- Args : [Arg {argCName = "string", argType = TInterface (Name {namespace = "GLib", name = "String"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GString being used to construct an HTTP header value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a parameter name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a parameter value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "soup_header_g_string_append_param_quoted" soup_header_g_string_append_param_quoted :: Ptr GLib.String.String -> -- string : TInterface (Name {namespace = "GLib", name = "String"}) CString -> -- name : TBasicType TUTF8 CString -> -- value : TBasicType TUTF8 IO () {- | Appends something like \<literal>/@name@/=\"/@value@/\"\<\/literal> to /@string@/, taking care to escape any quotes or backslashes in /@value@/. If /@value@/ is (non-ASCII) UTF-8, this will instead use RFC 5987 encoding, just like 'GI.Soup.Functions.headerGStringAppendParam'. /Since: 2.30/ -} headerGStringAppendParamQuoted :: (B.CallStack.HasCallStack, MonadIO m) => GLib.String.String {- ^ /@string@/: a 'GI.GLib.Structs.String.String' being used to construct an HTTP header value -} -> T.Text {- ^ /@name@/: a parameter name -} -> T.Text {- ^ /@value@/: a parameter value -} -> m () headerGStringAppendParamQuoted string name value = liftIO $ do string' <- unsafeManagedPtrGetPtr string name' <- textToCString name value' <- textToCString value soup_header_g_string_append_param_quoted string' name' value' touchManagedPtr string freeMem name' freeMem value' return () -- function soup_header_g_string_append_param -- Args : [Arg {argCName = "string", argType = TInterface (Name {namespace = "GLib", name = "String"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GString being used to construct an HTTP header value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a parameter name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a parameter value, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "soup_header_g_string_append_param" soup_header_g_string_append_param :: Ptr GLib.String.String -> -- string : TInterface (Name {namespace = "GLib", name = "String"}) CString -> -- name : TBasicType TUTF8 CString -> -- value : TBasicType TUTF8 IO () {- | Appends something like \<literal>/@name@/=/@value@/\<\/literal> to /@string@/, taking care to quote /@value@/ if needed, and if so, to escape any quotes or backslashes in /@value@/. Alternatively, if /@value@/ is a non-ASCII UTF-8 string, it will be appended using RFC5987 syntax. Although in theory this is supposed to work anywhere in HTTP that uses this style of parameter, in reality, it can only be used portably with the Content-Disposition \"filename\" parameter. If /@value@/ is 'Nothing', this will just append /@name@/ to /@string@/. /Since: 2.26/ -} headerGStringAppendParam :: (B.CallStack.HasCallStack, MonadIO m) => GLib.String.String {- ^ /@string@/: a 'GI.GLib.Structs.String.String' being used to construct an HTTP header value -} -> T.Text {- ^ /@name@/: a parameter name -} -> T.Text {- ^ /@value@/: a parameter value, or 'Nothing' -} -> m () headerGStringAppendParam string name value = liftIO $ do string' <- unsafeManagedPtrGetPtr string name' <- textToCString name value' <- textToCString value soup_header_g_string_append_param string' name' value' touchManagedPtr string freeMem name' freeMem value' return () -- function soup_header_free_param_list -- Args : [Arg {argCName = "param_list", argType = TGHash (TBasicType TUTF8) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GHashTable returned from soup_header_parse_param_list()\nor soup_header_parse_semi_param_list()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "soup_header_free_param_list" soup_header_free_param_list :: Ptr (GHashTable CString CString) -> -- param_list : TGHash (TBasicType TUTF8) (TBasicType TUTF8) IO () {- | Frees /@paramList@/. -} headerFreeParamList :: (B.CallStack.HasCallStack, MonadIO m) => Map.Map T.Text T.Text {- ^ /@paramList@/: a 'GI.GLib.Structs.HashTable.HashTable' returned from 'GI.Soup.Functions.headerParseParamList' or 'GI.Soup.Functions.headerParseSemiParamList' -} -> m () headerFreeParamList paramList = liftIO $ do let paramList' = Map.toList paramList paramList'' <- mapFirstA textToCString paramList' paramList''' <- mapSecondA textToCString paramList'' let paramList'''' = mapFirst cstringPackPtr paramList''' let paramList''''' = mapSecond cstringPackPtr paramList'''' paramList'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) paramList''''' soup_header_free_param_list paramList'''''' unrefGHashTable paramList'''''' return () -- function soup_header_contains -- Args : [Arg {argCName = "header", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "An HTTP header suitable for parsing with\nsoup_header_parse_list()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "token", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a token", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "soup_header_contains" soup_header_contains :: CString -> -- header : TBasicType TUTF8 CString -> -- token : TBasicType TUTF8 IO CInt {- | Parses /@header@/ to see if it contains the token /@token@/ (matched case-insensitively). Note that this can\'t be used with lists that have qvalues. -} headerContains :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@header@/: An HTTP header suitable for parsing with 'GI.Soup.Functions.headerParseList' -} -> T.Text {- ^ /@token@/: a token -} -> m Bool {- ^ __Returns:__ whether or not /@header@/ contains /@token@/ -} headerContains header token = liftIO $ do header' <- textToCString header token' <- textToCString token result <- soup_header_contains header' token' let result' = (/= 0) result freeMem header' freeMem token' return result' -- function soup_get_minor_version -- Args : [] -- Lengths : [] -- returnType : Just (TBasicType TUInt) -- throws : False -- Skip return : False foreign import ccall "soup_get_minor_version" soup_get_minor_version :: IO Word32 {- | Returns the minor version number of the libsoup library. (e.g. in libsoup version 2.42.0 this is 42.) This function is in the library, so it represents the libsoup library your code is running against. Contrast with the 'GI.Soup.Constants.MINOR_VERSION' macro, which represents the minor version of the libsoup headers you have included when compiling your code. /Since: 2.42/ -} getMinorVersion :: (B.CallStack.HasCallStack, MonadIO m) => m Word32 {- ^ __Returns:__ the minor version number of the libsoup library -} getMinorVersion = liftIO $ do result <- soup_get_minor_version return result -- function soup_get_micro_version -- Args : [] -- Lengths : [] -- returnType : Just (TBasicType TUInt) -- throws : False -- Skip return : False foreign import ccall "soup_get_micro_version" soup_get_micro_version :: IO Word32 {- | Returns the micro version number of the libsoup library. (e.g. in libsoup version 2.42.0 this is 0.) This function is in the library, so it represents the libsoup library your code is running against. Contrast with the 'GI.Soup.Constants.MICRO_VERSION' macro, which represents the micro version of the libsoup headers you have included when compiling your code. /Since: 2.42/ -} getMicroVersion :: (B.CallStack.HasCallStack, MonadIO m) => m Word32 {- ^ __Returns:__ the micro version number of the libsoup library -} getMicroVersion = liftIO $ do result <- soup_get_micro_version return result -- function soup_get_major_version -- Args : [] -- Lengths : [] -- returnType : Just (TBasicType TUInt) -- throws : False -- Skip return : False foreign import ccall "soup_get_major_version" soup_get_major_version :: IO Word32 {- | Returns the major version number of the libsoup library. (e.g. in libsoup version 2.42.0 this is 2.) This function is in the library, so it represents the libsoup library your code is running against. Contrast with the 'GI.Soup.Constants.MAJOR_VERSION' macro, which represents the major version of the libsoup headers you have included when compiling your code. /Since: 2.42/ -} getMajorVersion :: (B.CallStack.HasCallStack, MonadIO m) => m Word32 {- ^ __Returns:__ the major version number of the libsoup library -} getMajorVersion = liftIO $ do result <- soup_get_major_version return result -- function soup_form_request_new_from_multipart -- Args : [Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the URI to send the form data to", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "multipart", argType = TInterface (Name {namespace = "Soup", name = "Multipart"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a \"multipart/form-data\" #SoupMultipart", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Soup", name = "Message"})) -- throws : False -- Skip return : False foreign import ccall "soup_form_request_new_from_multipart" soup_form_request_new_from_multipart :: CString -> -- uri : TBasicType TUTF8 Ptr Soup.Multipart.Multipart -> -- multipart : TInterface (Name {namespace = "Soup", name = "Multipart"}) IO (Ptr Soup.Message.Message) {- | Creates a new @/SoupMessage/@ and sets it up to send /@multipart@/ to /@uri@/ via POST. To send a \<literal>\"multipart\/form-data\"\<\/literal> POST, first create a 'GI.Soup.Structs.Multipart.Multipart', using 'GI.Soup.Constants.FORM_MIME_TYPE_MULTIPART' as the MIME type. Then use 'GI.Soup.Structs.Multipart.multipartAppendFormString' and 'GI.Soup.Structs.Multipart.multipartAppendFormFile' to add the value of each form control to the multipart. (These are just convenience methods, and you can use 'GI.Soup.Structs.Multipart.multipartAppendPart' if you need greater control over the part headers.) Finally, call 'GI.Soup.Functions.formRequestNewFromMultipart' to serialize the multipart structure and create a 'GI.Soup.Objects.Message.Message'. /Since: 2.26/ -} formRequestNewFromMultipart :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@uri@/: the URI to send the form data to -} -> Soup.Multipart.Multipart {- ^ /@multipart@/: a \"multipart\/form-data\" 'GI.Soup.Structs.Multipart.Multipart' -} -> m Soup.Message.Message {- ^ __Returns:__ the new @/SoupMessage/@ -} formRequestNewFromMultipart uri multipart = liftIO $ do uri' <- textToCString uri multipart' <- unsafeManagedPtrGetPtr multipart result <- soup_form_request_new_from_multipart uri' multipart' checkUnexpectedReturnNULL "formRequestNewFromMultipart" result result' <- (wrapObject Soup.Message.Message) result touchManagedPtr multipart freeMem uri' return result' -- function soup_form_request_new_from_hash -- Args : [Arg {argCName = "method", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the HTTP method, either \"GET\" or \"POST\"", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the URI to send the form data to", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "form_data_set", argType = TGHash (TBasicType TUTF8) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the data to send to @uri", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Soup", name = "Message"})) -- throws : False -- Skip return : False foreign import ccall "soup_form_request_new_from_hash" soup_form_request_new_from_hash :: CString -> -- method : TBasicType TUTF8 CString -> -- uri : TBasicType TUTF8 Ptr (GHashTable CString CString) -> -- form_data_set : TGHash (TBasicType TUTF8) (TBasicType TUTF8) IO (Ptr Soup.Message.Message) {- | Creates a new @/SoupMessage/@ and sets it up to send /@formDataSet@/ to /@uri@/ via /@method@/, as with @/soup_form_request_new()/@. -} formRequestNewFromHash :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@method@/: the HTTP method, either \"GET\" or \"POST\" -} -> T.Text {- ^ /@uri@/: the URI to send the form data to -} -> Map.Map T.Text T.Text {- ^ /@formDataSet@/: the data to send to /@uri@/ -} -> m Soup.Message.Message {- ^ __Returns:__ the new @/SoupMessage/@ -} formRequestNewFromHash method uri formDataSet = liftIO $ do method' <- textToCString method uri' <- textToCString uri let formDataSet' = Map.toList formDataSet formDataSet'' <- mapFirstA textToCString formDataSet' formDataSet''' <- mapSecondA textToCString formDataSet'' let formDataSet'''' = mapFirst cstringPackPtr formDataSet''' let formDataSet''''' = mapSecond cstringPackPtr formDataSet'''' formDataSet'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) formDataSet''''' result <- soup_form_request_new_from_hash method' uri' formDataSet'''''' checkUnexpectedReturnNULL "formRequestNewFromHash" result result' <- (wrapObject Soup.Message.Message) result freeMem method' freeMem uri' unrefGHashTable formDataSet'''''' return result' -- function soup_form_request_new_from_datalist -- Args : [Arg {argCName = "method", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the HTTP method, either \"GET\" or \"POST\"", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the URI to send the form data to", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "form_data_set", argType = TInterface (Name {namespace = "GLib", name = "Data"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the data to send to @uri", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Soup", name = "Message"})) -- throws : False -- Skip return : False foreign import ccall "soup_form_request_new_from_datalist" soup_form_request_new_from_datalist :: CString -> -- method : TBasicType TUTF8 CString -> -- uri : TBasicType TUTF8 Ptr GLib.Data.Data -> -- form_data_set : TInterface (Name {namespace = "GLib", name = "Data"}) IO (Ptr Soup.Message.Message) {- | Creates a new @/SoupMessage/@ and sets it up to send /@formDataSet@/ to /@uri@/ via /@method@/, as with @/soup_form_request_new()/@. -} formRequestNewFromDatalist :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@method@/: the HTTP method, either \"GET\" or \"POST\" -} -> T.Text {- ^ /@uri@/: the URI to send the form data to -} -> GLib.Data.Data {- ^ /@formDataSet@/: the data to send to /@uri@/ -} -> m Soup.Message.Message {- ^ __Returns:__ the new @/SoupMessage/@ -} formRequestNewFromDatalist method uri formDataSet = liftIO $ do method' <- textToCString method uri' <- textToCString uri formDataSet' <- unsafeManagedPtrGetPtr formDataSet result <- soup_form_request_new_from_datalist method' uri' formDataSet' checkUnexpectedReturnNULL "formRequestNewFromDatalist" result result' <- (wrapObject Soup.Message.Message) result touchManagedPtr formDataSet freeMem method' freeMem uri' return result' -- function soup_form_encode_hash -- Args : [Arg {argCName = "form_data_set", argType = TGHash (TBasicType TUTF8) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a hash table containing\nname/value pairs (as strings)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "soup_form_encode_hash" soup_form_encode_hash :: Ptr (GHashTable CString CString) -> -- form_data_set : TGHash (TBasicType TUTF8) (TBasicType TUTF8) IO CString {- | Encodes /@formDataSet@/ into a value of type \"application\/x-www-form-urlencoded\", as defined in the HTML 4.01 spec. Note that the HTML spec states that \"The control names\/values are listed in the order they appear in the document.\" Since this method takes a hash table, it cannot enforce that; if you care about the ordering of the form fields, use 'GI.Soup.Functions.formEncodeDatalist'. -} formEncodeHash :: (B.CallStack.HasCallStack, MonadIO m) => Map.Map T.Text T.Text {- ^ /@formDataSet@/: a hash table containing name\/value pairs (as strings) -} -> m T.Text {- ^ __Returns:__ the encoded form -} formEncodeHash formDataSet = liftIO $ do let formDataSet' = Map.toList formDataSet formDataSet'' <- mapFirstA textToCString formDataSet' formDataSet''' <- mapSecondA textToCString formDataSet'' let formDataSet'''' = mapFirst cstringPackPtr formDataSet''' let formDataSet''''' = mapSecond cstringPackPtr formDataSet'''' formDataSet'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) formDataSet''''' result <- soup_form_encode_hash formDataSet'''''' checkUnexpectedReturnNULL "formEncodeHash" result result' <- cstringToText result freeMem result unrefGHashTable formDataSet'''''' return result' -- function soup_form_encode_datalist -- Args : [Arg {argCName = "form_data_set", argType = TInterface (Name {namespace = "GLib", name = "Data"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a datalist containing name/value pairs", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "soup_form_encode_datalist" soup_form_encode_datalist :: Ptr GLib.Data.Data -> -- form_data_set : TInterface (Name {namespace = "GLib", name = "Data"}) IO CString {- | Encodes /@formDataSet@/ into a value of type \"application\/x-www-form-urlencoded\", as defined in the HTML 4.01 spec. Unlike 'GI.Soup.Functions.formEncodeHash', this preserves the ordering of the form elements, which may be required in some situations. -} formEncodeDatalist :: (B.CallStack.HasCallStack, MonadIO m) => GLib.Data.Data {- ^ /@formDataSet@/: a datalist containing name\/value pairs -} -> m T.Text {- ^ __Returns:__ the encoded form -} formEncodeDatalist formDataSet = liftIO $ do formDataSet' <- unsafeManagedPtrGetPtr formDataSet result <- soup_form_encode_datalist formDataSet' checkUnexpectedReturnNULL "formEncodeDatalist" result result' <- cstringToText result freeMem result touchManagedPtr formDataSet return result' -- function soup_form_decode_multipart -- XXX Could not generate function soup_form_decode_multipart -- Error was : Not implemented: "Hash table argument with transfer = Container? result'" -- function soup_form_decode -- XXX Could not generate function soup_form_decode -- Error was : Not implemented: "Hash table argument with transfer = Container? result" -- function soup_cookies_to_response -- Args : [Arg {argCName = "cookies", argType = TGSList (TInterface (Name {namespace = "Soup", name = "Cookie"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GSList of #SoupCookie", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMessage", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "soup_cookies_to_response" soup_cookies_to_response :: Ptr (GSList (Ptr Soup.Cookie.Cookie)) -> -- cookies : TGSList (TInterface (Name {namespace = "Soup", name = "Cookie"})) Ptr Soup.Message.Message -> -- msg : TInterface (Name {namespace = "Soup", name = "Message"}) IO () {- | Appends a \"Set-Cookie\" response header to /@msg@/ for each cookie in /@cookies@/. (This is in addition to any other \"Set-Cookie\" headers /@msg@/ may already have.) /Since: 2.24/ -} cookiesToResponse :: (B.CallStack.HasCallStack, MonadIO m, Soup.Message.IsMessage a) => [Soup.Cookie.Cookie] {- ^ /@cookies@/: a 'GI.GLib.Structs.SList.SList' of 'GI.Soup.Structs.Cookie.Cookie' -} -> a {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -} -> m () cookiesToResponse cookies msg = liftIO $ do cookies' <- mapM unsafeManagedPtrGetPtr cookies cookies'' <- packGSList cookies' msg' <- unsafeManagedPtrCastPtr msg soup_cookies_to_response cookies'' msg' mapM_ touchManagedPtr cookies touchManagedPtr msg g_slist_free cookies'' return () -- function soup_cookies_to_request -- Args : [Arg {argCName = "cookies", argType = TGSList (TInterface (Name {namespace = "Soup", name = "Cookie"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GSList of #SoupCookie", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMessage", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "soup_cookies_to_request" soup_cookies_to_request :: Ptr (GSList (Ptr Soup.Cookie.Cookie)) -> -- cookies : TGSList (TInterface (Name {namespace = "Soup", name = "Cookie"})) Ptr Soup.Message.Message -> -- msg : TInterface (Name {namespace = "Soup", name = "Message"}) IO () {- | Adds the name and value of each cookie in /@cookies@/ to /@msg@/\'s \"Cookie\" request. (If /@msg@/ already has a \"Cookie\" request header, these cookies will be appended to the cookies already present. Be careful that you do not append the same cookies twice, eg, when requeuing a message.) /Since: 2.24/ -} cookiesToRequest :: (B.CallStack.HasCallStack, MonadIO m, Soup.Message.IsMessage a) => [Soup.Cookie.Cookie] {- ^ /@cookies@/: a 'GI.GLib.Structs.SList.SList' of 'GI.Soup.Structs.Cookie.Cookie' -} -> a {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -} -> m () cookiesToRequest cookies msg = liftIO $ do cookies' <- mapM unsafeManagedPtrGetPtr cookies cookies'' <- packGSList cookies' msg' <- unsafeManagedPtrCastPtr msg soup_cookies_to_request cookies'' msg' mapM_ touchManagedPtr cookies touchManagedPtr msg g_slist_free cookies'' return () -- function soup_cookies_to_cookie_header -- Args : [Arg {argCName = "cookies", argType = TGSList (TInterface (Name {namespace = "Soup", name = "Cookie"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GSList of #SoupCookie", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "soup_cookies_to_cookie_header" soup_cookies_to_cookie_header :: Ptr (GSList (Ptr Soup.Cookie.Cookie)) -> -- cookies : TGSList (TInterface (Name {namespace = "Soup", name = "Cookie"})) IO CString {- | Serializes a 'GI.GLib.Structs.SList.SList' of 'GI.Soup.Structs.Cookie.Cookie' into a string suitable for setting as the value of the \"Cookie\" header. /Since: 2.24/ -} cookiesToCookieHeader :: (B.CallStack.HasCallStack, MonadIO m) => [Soup.Cookie.Cookie] {- ^ /@cookies@/: a 'GI.GLib.Structs.SList.SList' of 'GI.Soup.Structs.Cookie.Cookie' -} -> m T.Text {- ^ __Returns:__ the serialization of /@cookies@/ -} cookiesToCookieHeader cookies = liftIO $ do cookies' <- mapM unsafeManagedPtrGetPtr cookies cookies'' <- packGSList cookies' result <- soup_cookies_to_cookie_header cookies'' checkUnexpectedReturnNULL "cookiesToCookieHeader" result result' <- cstringToText result freeMem result mapM_ touchManagedPtr cookies g_slist_free cookies'' return result' -- function soup_cookies_from_response -- Args : [Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMessage containing a \"Set-Cookie\" response header", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TGSList (TInterface (Name {namespace = "Soup", name = "Cookie"}))) -- throws : False -- Skip return : False foreign import ccall "soup_cookies_from_response" soup_cookies_from_response :: Ptr Soup.Message.Message -> -- msg : TInterface (Name {namespace = "Soup", name = "Message"}) IO (Ptr (GSList (Ptr Soup.Cookie.Cookie))) {- | Parses /@msg@/\'s Set-Cookie response headers and returns a 'GI.GLib.Structs.SList.SList' of 'GI.Soup.Structs.Cookie.Cookie'\<!-- -->s. Cookies that do not specify \"path\" or \"domain\" attributes will have their values defaulted from /@msg@/. /Since: 2.24/ -} cookiesFromResponse :: (B.CallStack.HasCallStack, MonadIO m, Soup.Message.IsMessage a) => a {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' containing a \"Set-Cookie\" response header -} -> m [Soup.Cookie.Cookie] {- ^ __Returns:__ a 'GI.GLib.Structs.SList.SList' of 'GI.Soup.Structs.Cookie.Cookie'\<!-- -->s, which can be freed with @/soup_cookies_free()/@. -} cookiesFromResponse msg = liftIO $ do msg' <- unsafeManagedPtrCastPtr msg result <- soup_cookies_from_response msg' result' <- unpackGSList result result'' <- mapM (wrapBoxed Soup.Cookie.Cookie) result' g_slist_free result touchManagedPtr msg return result'' -- function soup_cookies_from_request -- Args : [Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMessage containing a \"Cookie\" request header", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TGSList (TInterface (Name {namespace = "Soup", name = "Cookie"}))) -- throws : False -- Skip return : False foreign import ccall "soup_cookies_from_request" soup_cookies_from_request :: Ptr Soup.Message.Message -> -- msg : TInterface (Name {namespace = "Soup", name = "Message"}) IO (Ptr (GSList (Ptr Soup.Cookie.Cookie))) {- | Parses /@msg@/\'s Cookie request header and returns a 'GI.GLib.Structs.SList.SList' of 'GI.Soup.Structs.Cookie.Cookie'\<!-- -->s. As the \"Cookie\" header, unlike \"Set-Cookie\", only contains cookie names and values, none of the other 'GI.Soup.Structs.Cookie.Cookie' fields will be filled in. (Thus, you can\'t generally pass a cookie returned from this method directly to 'GI.Soup.Functions.cookiesToResponse'.) /Since: 2.24/ -} cookiesFromRequest :: (B.CallStack.HasCallStack, MonadIO m, Soup.Message.IsMessage a) => a {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' containing a \"Cookie\" request header -} -> m [Soup.Cookie.Cookie] {- ^ __Returns:__ a 'GI.GLib.Structs.SList.SList' of 'GI.Soup.Structs.Cookie.Cookie'\<!-- -->s, which can be freed with @/soup_cookies_free()/@. -} cookiesFromRequest msg = liftIO $ do msg' <- unsafeManagedPtrCastPtr msg result <- soup_cookies_from_request msg' result' <- unpackGSList result result'' <- mapM (wrapBoxed Soup.Cookie.Cookie) result' g_slist_free result touchManagedPtr msg return result'' -- function soup_check_version -- Args : [Arg {argCName = "major", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the major version to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "minor", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the minor version to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "micro", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the micro version to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "soup_check_version" soup_check_version :: Word32 -> -- major : TBasicType TUInt Word32 -> -- minor : TBasicType TUInt Word32 -> -- micro : TBasicType TUInt IO CInt {- | Like SOUP_CHECK_VERSION, but the check for soup_check_version is at runtime instead of compile time. This is useful for compiling against older versions of libsoup, but using features from newer versions. /Since: 2.42/ -} checkVersion :: (B.CallStack.HasCallStack, MonadIO m) => Word32 {- ^ /@major@/: the major version to check -} -> Word32 {- ^ /@minor@/: the minor version to check -} -> Word32 {- ^ /@micro@/: the micro version to check -} -> m Bool {- ^ __Returns:__ 'True' if the version of the libsoup currently loaded is the same as or newer than the passed-in version. -} checkVersion major minor micro = liftIO $ do result <- soup_check_version major minor micro let result' = (/= 0) result return result'