-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell binding to libcurl -- -- libcurl is a client-side URL transfer library, supporting FTP, FTPS, -- HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS and FILE. -- libcurl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, -- HTTP form based upload, proxies, cookies, user+password authentication -- (Basic, Digest, NTLM, Negotiate, Kerberos4), file transfer resume, -- http proxy tunneling and more! -- -- This package provides a Haskell binding to libcurl. @package curl @version 1.3.8 module Network.Curl.Debug debug :: String -> IO () -- | Representing Curl's status codes as a Haskell type. module Network.Curl.Code data CurlCode CurlOK :: CurlCode CurlUnspportedProtocol :: CurlCode CurlFailedInit :: CurlCode CurlUrlMalformat :: CurlCode CurlUrlMalformatUser :: CurlCode CurlCouldntResolveProxy :: CurlCode CurlCouldntResolveHost :: CurlCode CurlCouldntConnect :: CurlCode CurlFtpWeirdServerReply :: CurlCode CurlFtpAccessDenied :: CurlCode CurlFtpUserPasswordIncorrect :: CurlCode CurlFtpWeirdPassReply :: CurlCode CurlFtpWeirdUserReply :: CurlCode CurlFtpWeirdPASVReply :: CurlCode CurlFtpWeird227Format :: CurlCode CurlFtpCantGetHost :: CurlCode CurlFtpCantReconnect :: CurlCode CurlFtpCouldnSetBinary :: CurlCode CurlPartialFile :: CurlCode CurlFtpCouldntRetrFile :: CurlCode CurlFtpWriteError :: CurlCode CurlFtpQuoteError :: CurlCode CurlHttpReturnedError :: CurlCode CurlWriteError :: CurlCode CurlMalformatError :: CurlCode CurlFtpCouldnStorFile :: CurlCode CurlReadError :: CurlCode CurlOutOfMemory :: CurlCode CurlOperationTimeout :: CurlCode CurlFtpCouldntSetAscii :: CurlCode CurlFtpPortFailed :: CurlCode CurlFtpCouldntUseRest :: CurlCode CurlFtpCouldntGetSize :: CurlCode CurlHttpRangeError :: CurlCode CurlHttpPostError :: CurlCode CurlSSLConnectError :: CurlCode CurlBadDownloadResume :: CurlCode CurlFileCouldntReadFile :: CurlCode CurlLDAPCannotBind :: CurlCode CurlLDPAPSearchFailed :: CurlCode CurlLibraryNotFound :: CurlCode CurlFunctionNotFound :: CurlCode CurlAbortedByCallback :: CurlCode CurlBadFunctionArgument :: CurlCode CurlBadCallingOrder :: CurlCode CurlInterfaceFailed :: CurlCode CurlBadPasswordEntered :: CurlCode CurlTooManyRedirects :: CurlCode CurlUnknownTelnetOption :: CurlCode CurlTelnetOptionSyntax :: CurlCode CurlObsolete :: CurlCode CurlSSLPeerCertificate :: CurlCode CurlGotNothing :: CurlCode CurlSSLEngineNotFound :: CurlCode CurlSSLEngineSetFailed :: CurlCode CurlSendError :: CurlCode CurlRecvError :: CurlCode CurlShareInUse :: CurlCode CurlSSLCertProblem :: CurlCode CurlSSLCipher :: CurlCode CurlSSLCACert :: CurlCode CurlBadContentEncoding :: CurlCode CurlLDAPInvalidUrl :: CurlCode CurlFilesizeExceeded :: CurlCode CurlFtpSSLFailed :: CurlCode CurlSendFailRewind :: CurlCode CurlSSLEngineInitFailed :: CurlCode CurlLoginDenied :: CurlCode CurlTFtpNotFound :: CurlCode CurlTFtpPerm :: CurlCode CurlTFtpDiskFull :: CurlCode CurlTFtpIllegal :: CurlCode CurlTFtpUnknownId :: CurlCode CurlTFtpExists :: CurlCode CurlTFtpNoSuchUser :: CurlCode CurlConvFailed :: CurlCode CurlConvReqd :: CurlCode CurlSSLCACertBadFile :: CurlCode CurlRemoveFileNotFound :: CurlCode CurlSSH :: CurlCode CurlSSLShutdownFailed :: CurlCode CurlAgain :: CurlCode CurlSSLCRLBadFile :: CurlCode CurlSSLIssuerError :: CurlCode toCode :: CInt -> CurlCode instance Eq CurlCode instance Show CurlCode instance Enum CurlCode -- | Basic set of types for the Haskell curl binding, including the -- Curl handle type which holds the C library stateful -- connection handle along with a set of cleanup actions tht should be -- performed upon shutting down the curl session. module Network.Curl.Types type CurlH = Ptr Curl_ type URLString = String type Port = Long type Long = Word32 type LLong = Word64 data Slist_ data Curl -- | Execute a primitve curl operation. NOTE: See warnings about the -- use of withForeginPtr. curlPrim :: Curl -> (IORef OptionMap -> CurlH -> IO a) -> IO a -- | Allocates a Haskell handle from a C handle. mkCurl :: CurlH -> IO Curl -- | Allocates a Haskell handle from a C handle. mkCurlWithCleanup :: CurlH -> OptionMap -> IO Curl type OptionMap = IntMap (IO ()) shareCleanup :: IORef OptionMap -> IO OptionMap runCleanup :: IORef OptionMap -> IO () updateCleanup :: IORef OptionMap -> Int -> IO () -> IO () -- | Accessing the properties of a curl handle's current state/request. module Network.Curl.Info data Info EffectiveUrl :: Info ResponseCode :: Info TotalTime :: Info NameLookupTime :: Info ConnectTime :: Info PreTransferTime :: Info SizeUpload :: Info SizeDownload :: Info SpeedDownload :: Info SpeedUpload :: Info HeaderSize :: Info RequestSize :: Info SslVerifyResult :: Info Filetime :: Info ContentLengthDownload :: Info ContentLengthUpload :: Info StartTransferTime :: Info ContentType :: Info RedirectTime :: Info RedirectCount :: Info Private :: Info HttpConnectCode :: Info HttpAuthAvail :: Info ProxyAuthAvail :: Info OSErrno :: Info NumConnects :: Info SslEngines :: Info CookieList :: Info LastSocket :: Info FtpEntryPath :: Info data InfoValue IString :: String -> InfoValue ILong :: Long -> InfoValue IDouble :: Double -> InfoValue IList :: [String] -> InfoValue getInfo :: Curl -> Info -> IO InfoValue instance Show Info instance Enum Info instance Bounded Info instance Show InfoValue -- | Representing and marshalling formdata (as part of POST -- uploads/submissions.) If you are only looking to submit a sequence of -- name=value pairs, you are better off using the CurlPostFields -- constructor; much simpler. module Network.Curl.Post type Header = String data HttpPost HttpPost :: String -> Maybe String -> Content -> [Header] -> Maybe String -> HttpPost postName :: HttpPost -> String contentType :: HttpPost -> Maybe String content :: HttpPost -> Content extraHeaders :: HttpPost -> [Header] showName :: HttpPost -> Maybe String data Content ContentFile :: FilePath -> Content ContentBuffer :: (Ptr CChar) -> Long -> Content ContentString :: String -> Content multiformString :: String -> String -> HttpPost sizeof_httppost :: Int marshallPosts :: [HttpPost] -> IO (Ptr HttpPost) marshallPost :: HttpPost -> IO (Ptr HttpPost) curl_slist_append :: Ptr Slist_ -> CString -> IO (Ptr Slist_) curl_slist_free :: Ptr Slist_ -> IO () curl_formfree :: Ptr a -> IO () instance Eq Content instance Show Content instance Eq HttpPost instance Show HttpPost -- | This module contains the various options that specify what happens -- when we use perform on a Curl handle. module Network.Curl.Opts data CurlOption -- | external pointer to pass to as WriteFunctions last argument. CurlFileObj :: (Ptr ()) -> CurlOption -- | the URL to use for next request; can be the full URL or just the -- authority/hostname. CurlURL :: URLString -> CurlOption -- | what port to use. CurlPort :: Long -> CurlOption -- | name of proxy CurlProxy :: String -> CurlOption -- | the user:pass string to use CurlUserPwd :: String -> CurlOption -- | same thing, but for the proxy. CurlProxyUserPwd :: String -> CurlOption -- | byte range to fetch CurlRange :: String -> CurlOption -- | external pointer to pass to as WriteFunctions last argument. CurlInFile :: FilePath -> CurlOption -- | buffer for curl to deposit error messages (must at least -- CURL_ERROR_SIZE bytes long). Uses standard error if not specified. CurlErrorBuffer :: (Ptr CChar) -> CurlOption -- | callback to handle incoming data. CurlWriteFunction :: WriteFunction -> CurlOption -- | callback for supplying outgoing/uploaded data. CurlReadFunction :: ReadFunction -> CurlOption -- | number of seconds before timing out curl operation/request. CurlTimeout :: Long -> CurlOption -- | expected size of uploaded data. CurlInFileSize :: Long -> CurlOption -- | (Multipart) POST data. CurlPostFields :: [String] -> CurlOption -- | Set the Referer: header to the given string. CurlReferer :: String -> CurlOption -- | The string to feed to the FTP PORT command. CurlFtpPort :: String -> CurlOption -- | Set the User-Agent: header to the given string. CurlUserAgent :: String -> CurlOption -- | If the bytes per sec drops below the given value, the operation is -- aborted. CurlLowSpeed :: Long -> CurlOption -- | Upper bound for request to complete. CurlLowSpeedTime :: Long -> CurlOption -- | Byte offset at which the transfer (HTTP or FTP) should start from. CurlResumeFrom :: Long -> CurlOption -- | Set the Cookie: header to the given cookie (name=value pairs, -- semicolon-separated) string. CurlCookie :: String -> CurlOption -- | Embellish the outgoing request with the given list of (formatted) -- header values. CurlHttpHeaders :: [String] -> CurlOption -- | (Multipart) POST data. CurlHttpPost :: [HttpPost] -> CurlOption -- | file holding your private SSL certificates (default format is PEM). CurlSSLCert :: FilePath -> CurlOption -- | password to the above file. CurlSSLPassword :: String -> CurlOption -- | an alias for the previous. CurlSSLKeyPassword :: String -> CurlOption -- | If true, convert Unix newlines into CRLFs when transferring. CurlCRLF :: Bool -> CurlOption -- | Sequence of FTP commands to execute prior to the main request. CurlQuote :: [String] -> CurlOption -- | State / pointer argument to pass to WriteFunction callback. CurlWriteHeader :: (Ptr ()) -> CurlOption -- | Path to file holding initial cookie data; also enables cookie -- handling. CurlCookieFile :: FilePath -> CurlOption -- | What protocol to attempt using (0:default;1:TLS;2:SSLv2;3:SSLv3) CurlSSLVersion :: Long -> CurlOption -- | How to interpret a conditional time value. CurlTimeCondition :: TimeCond -> CurlOption -- | Number of secs since Jan 1, 1970. Interpretation is determined by -- CurlTimeCondition. CurlTimeValue :: Long -> CurlOption -- | String holding alternative request command (WebDAV anyone?) CurlCustomRequest :: String -> CurlOption -- | List of commands to issue to FTP server after the main request. CurlPostQuote :: [String] -> CurlOption -- | Not sure what this one does; something about passing it to the output -- function. CurlWriteInfo :: String -> CurlOption -- | Control verbosity CurlVerbose :: Bool -> CurlOption -- | Display outgoing and incoming headers CurlHeader :: Bool -> CurlOption -- | Control progress meter CurlNoProgress :: Bool -> CurlOption -- | Use HEAD instead of GET CurlNoBody :: Bool -> CurlOption -- | If status response is >= 300, return an error (and no other -- output). CurlFailOnError :: Bool -> CurlOption -- | Control the main dataflow, i.e., True to perform uploads. CurlUpload :: Bool -> CurlOption -- | Issue a POST request. CurlPost :: Bool -> CurlOption -- | Switch NLST for FTP directory listings CurlFtpListOnly :: Bool -> CurlOption -- | Control if FTP uploads append rather than overwrite files CurlFtpAppend :: Bool -> CurlOption -- | control how or if a user's.netrc will be consulted for user:password CurlUseNetRc :: NetRcOption -> CurlOption -- | Handle auto-redirects by chasing down Location: values in responses. CurlFollowLocation :: Bool -> CurlOption -- | Turn on ASCII transfers for FTP transfers; default is binary (i.e. -- off). CurlTransferTextASCII :: Bool -> CurlOption -- | Use PUT to upload data. CurlPut :: Bool -> CurlOption -- | callback for showing progress CurlProgressFunction :: ProgressFunction -> CurlOption -- | state argumentto pass to progress callback. CurlProgressData :: (Ptr ()) -> CurlOption -- | Control if the Referer: field is set upon following Location: -- redirects CurlAutoReferer :: Bool -> CurlOption -- | (Numeric) proxy port to use. CurlProxyPort :: Long -> CurlOption -- | Size of the POSTed data. CurlPostFieldSize :: Long -> CurlOption -- | tunnel all HTTP operations through the proxy. CurlHttpProxyTunnel :: Bool -> CurlOption -- | Interface name of outgoing network interface ( network interface, IP -- address, host name.) CurlInterface :: String -> CurlOption -- | Kerberos security level (clear, safe, -- confidential, private are good values, seemingly.) CurlKrb4Level :: String -> CurlOption -- | Enable the authentication of peer certificate. Default is True. CurlSSLVerifyPeer :: Bool -> CurlOption -- | If verifying peer's certificate, use certificates in this file to do -- so. CurlCAInfo :: FilePath -> CurlOption -- | Maximum number of Location: redirects to chase down before giving up. CurlMaxRedirs :: Long -> CurlOption -- | Try to determine the modification date of remote document; can be -- queried for. CurlFiletime :: Bool -> CurlOption -- | List of commands to use for initial telnet negotiations. CurlTelnetOptions :: [String] -> CurlOption -- | Maximum number of cached active connections. CurlMaxConnects :: Long -> CurlOption -- | No effect (obsolete.) CurlClosePolicy :: Long -> CurlOption -- | Force the opening up a new connection rather than try to reuse active -- connections. Default is not to. CurlFreshConnect :: Bool -> CurlOption -- | Do not reuse the connection of next transfer when done. CurlForbidReuse :: Bool -> CurlOption -- | Path to file used to seed (Open)SSL PRNG. CurlRandomFile :: FilePath -> CurlOption -- | Path to domain socket of EG Daemon. CurlEgdSocket :: FilePath -> CurlOption -- | max number of seconds to wait for the initial connection to happen. CurlConnectTimeout :: Long -> CurlOption -- | callback used to handle _incoming_ header data. CurlHeaderFunction :: WriteFunction -> CurlOption -- | Revert to a GET for the next request. CurlHttpGet :: Bool -> CurlOption -- | Perform Common name checking in peer certificate (1=> -- existence;2=> matches hostname.) CurlSSLVerifyHost :: Long -> CurlOption -- | Path to file where additional cookie information will be stored. CurlCookieJar :: FilePath -> CurlOption -- | Colon-separated string list of cipher preferences to use for upcoming -- connection (e.g., 3DES:+RSA) CurlSSLCipherList :: String -> CurlOption -- | What HTTP version to use, should you want to drop back for some -- reason. CurlHttpVersion :: HttpVersion -> CurlOption -- | Attempt the use of EPSV before PASV for passive FTP downloads. CurlFtpUseEPSV :: Bool -> CurlOption -- | The format of your certificates (PEM, DER) CurlSSLCertType :: String -> CurlOption -- | Filename of private key. CurlSSLKey :: FilePath -> CurlOption -- | Format of private key; use ENG to load from a crypto engine. CurlSSLKeyType :: String -> CurlOption -- | Name of crypto engine to use. CurlSSLEngine :: String -> CurlOption -- | Make crypto engine the default for crypto operations. CurlSSLEngineDefault :: CurlOption -- | Have library uses its MT-unfriendly DNS global cache. CurlDNSUseGlobalCache :: Bool -> CurlOption -- | Number of seconds to cache results of DNS lookups in memory. CurlDNSCacheTimeout :: Long -> CurlOption -- | FTP commands to issue after connection and transfer mode has been set. CurlPreQuote :: [String] -> CurlOption -- | callback to catch and report transfer operations. CurlDebugFunction :: DebugFunction -> CurlOption -- | state argument to pass to debug callback. CurlDebugData :: (Ptr ()) -> CurlOption -- | Signal the start of a cookie session, ignoring previous session -- cookies. CurlCookieSession :: Bool -> CurlOption -- | Directory holding CA certificates; used when verifying peer -- certificate. CurlCAPath :: FilePath -> CurlOption -- | Turn (down, presumably) the buffers the received data is chunked up -- into (and reported to the WriteFunction.) A hint, library is free to -- ignore. CurlBufferSize :: Long -> CurlOption -- | Turn off use of signals internally. CurlNoSignal :: Bool -> CurlOption -- | Share handles are used for sharing data among concurrent Curl objects. CurlShare :: (Ptr ()) -> CurlOption -- | What type of proxy to use. CurlProxyType :: Long -> CurlOption -- | What to report in the Accept-Encoding: header CurlEncoding :: String -> CurlOption -- | Data associated with a Curl handle. CurlPrivate :: (Ptr ()) -> CurlOption -- | Alternatives to standard 200 OK response strings; whatever it takes, I -- suppose. CurlHttp200Aliases :: String -> CurlOption -- | Pass on user:pass when following redirects. CurlUnrestrictedAuth :: Bool -> CurlOption -- | For active FTP downloads, try using EPRT command over LPRT. CurlFtppUseEPRT :: Bool -> CurlOption -- | State your authentication preferences. CurlHttpAuth :: [HttpAuth] -> CurlOption -- | callback to handle setting up SSL connections; have the power to abort -- them. CurlSSLCtxFunction :: SSLCtxtFunction -> CurlOption -- | state argument to pass into the above callback. CurlSSLCtxData :: (Ptr ()) -> CurlOption -- | Have remote directories be created if not already there CurlFtpCreateMissingDirs :: Bool -> CurlOption -- | What preferred authentication schemes to use wrt. proxy. CurlProxyAuth :: [HttpAuth] -> CurlOption -- | max number of seconds to wait for remote server to ACK commands. CurlFtpResponseTimeout :: Long -> CurlOption -- | Whether to resolve wrt IPv4 or IPv6. CurlIPResolve :: Long -> CurlOption -- | Limit the number of bytes you're willing to download. CurlMaxFileSize :: Long -> CurlOption -- | Wider alternative of option giving upper bound of uploaded content (-1 -- => unknown.) CurlInFileSizeLarge :: LLong -> CurlOption -- | Wider alternative for specifying initial transfer offset. CurlResumeFromLarge :: LLong -> CurlOption -- | Wider alternative for specifying max download size. CurlMaxFileSizeLarge :: LLong -> CurlOption -- | Path to user's .netrc CurlNetrcFile :: FilePath -> CurlOption -- | Try enabling the use of SSL for FTP control connections and/or -- transfers. CurlFtpSSL :: Long -> CurlOption -- | Size of data to POST; if unspecified (or -1), curl uses strlen(). CurlPostFieldSizeLarge :: LLong -> CurlOption -- | Turn on or off the TCP/IP NODELAY option. CurlTCPNoDelay :: Bool -> CurlOption -- | Twiddle if TLS or SSL is used. CurlFtpSSLAuth :: Long -> CurlOption -- | somewhat obscure callback for handling read stream resets. CurlIOCTLFunction :: (Ptr ()) -> CurlOption -- | state argument to the above. CurlIOCTLData :: (Ptr ()) -> CurlOption -- | The string to use when server asks for account info. CurlFtpAccount :: String -> CurlOption -- | Cookie string to pass cookie engine; ALL scrubs all cookie -- info; SESS scrubs session ones. CurlCookieList :: String -> CurlOption -- | If Content-Length: values are troublesome (wrong, perhaps?), use this -- option to ignore using them as guidance. CurlIgnoreContentLength :: Bool -> CurlOption -- | Ignore IP address in 227 responses. CurlFtpSkipPASVIP :: Bool -> CurlOption -- | How to navigate to a file on the remote server (single, multiple -- CWDs). CurlFtpFileMethod :: Long -> CurlOption -- | What local port to use for established connection. CurlLocalPort :: Port -> CurlOption -- | Number of attempts at finding local ports (using LocalPort as initial -- base.) CurlLocalPortRange :: Port -> CurlOption -- | If enabled, perform all steps up until actual transfer. next three for -- completeness. CurlConnectOnly :: Bool -> CurlOption -- | callback for doing character translations from network format. CurlConvFromNetworkFunction :: (Ptr ()) -> CurlOption -- | callback for doing character translations to network format. CurlConvToNetworkFunction :: (Ptr ()) -> CurlOption -- | callback for translating UTF8 into host encoding. CurlConvFromUtf8Function :: (Ptr ()) -> CurlOption -- | Specifies throttle value for outgoing data. CurlMaxSendSpeedLarge :: LLong -> CurlOption -- | Specifies throttle for incoming data. CurlMaxRecvSpeedLarge :: LLong -> CurlOption -- | Alternative (to user:pass) for FTP authentication; weird. CurlFtpAlternativeToUser :: String -> CurlOption -- | callback that's injected between socket creation and connection. CurlSockOptFunction :: (Ptr ()) -> CurlOption -- | state argument to the above. CurlSockOptData :: (Ptr ()) -> CurlOption -- | Enable the SSL session id cache; default is on, so use this to -- disable. CurlSSLSessionIdCache :: Bool -> CurlOption -- | SSH authentication methods to use. CurlSSHAuthTypes :: [SSHAuthType] -> CurlOption -- | Path to file holding user's SSH public key. CurlSSHPublicKeyFile :: FilePath -> CurlOption -- | Path to file holding user's SSH private key. CurlSSHPrivateKeyFile :: FilePath -> CurlOption -- | Send CCC command after FTP connection has been authenticated. CurlFtpSSLCCC :: Bool -> CurlOption -- | Max number of milliseconds that a transfer may take. CurlTimeoutMS :: Long -> CurlOption -- | Max number of milliseconds that a connection attempt may take to -- complete. CurlConnectTimeoutMS :: Long -> CurlOption -- | Disable transfer decoding; if disabled, curl will turn off chunking. CurlHttpTransferDecoding :: Bool -> CurlOption -- | Disable content decoding, getting the raw bits. sync'ed wrt 7.19.2 CurlHttpContentDecoding :: Bool -> CurlOption CurlNewFilePerms :: Long -> CurlOption CurlNewDirectoryPerms :: Long -> CurlOption CurlPostRedirect :: Bool -> CurlOption CurlSSHHostPublicKeyMD5 :: String -> CurlOption CurlCopyPostFields :: Bool -> CurlOption CurlProxyTransferMode :: Long -> CurlOption CurlCRLFile :: FilePath -> CurlOption CurlIssuerCert :: FilePath -> CurlOption CurlAddressScope :: Long -> CurlOption CurlCertInfo :: Long -> CurlOption CurlUserName :: String -> CurlOption CurlUserPassword :: String -> CurlOption CurlProxyUser :: String -> CurlOption CurlProxyPassword :: String -> CurlOption data HttpVersion HttpVersionNone :: HttpVersion HttpVersion10 :: HttpVersion HttpVersion11 :: HttpVersion data TimeCond TimeCondNone :: TimeCond TimeCondIfModSince :: TimeCond TimeCondIfUnmodSince :: TimeCond TimeCondLastMode :: TimeCond data NetRcOption NetRcIgnored :: NetRcOption NetRcOptional :: NetRcOption NetRcRequired :: NetRcOption data HttpAuth HttpAuthNone :: HttpAuth HttpAuthBasic :: HttpAuth HttpAuthDigest :: HttpAuth HttpAuthGSSNegotiate :: HttpAuth HttpAuthNTLM :: HttpAuth HttpAuthAny :: HttpAuth HttpAuthAnySafe :: HttpAuth toHttpAuthMask :: [HttpAuth] -> Long data SSHAuthType SSHAuthAny :: SSHAuthType SSHAuthNone :: SSHAuthType SSHAuthPublickey :: SSHAuthType SSHAuthPassword :: SSHAuthType SSHAuthHost :: SSHAuthType SSHAuthKeyboard :: SSHAuthType toSSHAuthMask :: [SSHAuthType] -> Long type WriteFunction = Ptr CChar -> CInt -> CInt -> Ptr () -> IO CInt type ReadFunction = Ptr CChar -> CInt -> CInt -> Ptr () -> IO (Maybe CInt) type ReadFunctionPrim = Ptr CChar -> CInt -> CInt -> Ptr () -> IO CInt type ProgressFunction = Ptr () -> Double -> Double -> Double -> Double -> IO CInt type DebugFunction = Curl -> DebugInfo -> Ptr CChar -> CInt -> Ptr () -> IO () data DebugInfo InfoText :: DebugInfo InfoHeaderIn :: DebugInfo InfoHeaderOut :: DebugInfo InfoDataIn :: DebugInfo InfoDataOut :: DebugInfo InfoSslDataIn :: DebugInfo InfoSslDataOut :: DebugInfo type DebugFunctionPrim = CurlH -> CInt -> Ptr CChar -> CInt -> Ptr () -> IO CInt type SSLCtxtFunction = CurlH -> Ptr () -> Ptr () -> IO CInt curl_readfunc_abort :: CInt baseLong :: Int baseObject :: Int baseFunction :: Int baseOffT :: Int unmarshallOption :: Unmarshaller a -> CurlOption -> IO a data Unmarshaller a Unmarshaller :: (Int -> Long -> IO a) -> (Int -> LLong -> IO a) -> (Int -> String -> IO a) -> (Int -> [String] -> IO a) -> (Int -> Ptr () -> IO a) -> (Int -> WriteFunction -> IO a) -> (Int -> ReadFunction -> IO a) -> (Int -> ProgressFunction -> IO a) -> (Int -> DebugFunction -> IO a) -> (Int -> [HttpPost] -> IO a) -> (Int -> SSLCtxtFunction -> IO a) -> (Int -> Ptr () -> IO a) -> (Int -> Ptr () -> IO a) -> (Int -> Ptr () -> IO a) -> (Int -> Ptr () -> IO a) -> (Int -> Ptr () -> IO a) -> Unmarshaller a u_long :: Unmarshaller a -> Int -> Long -> IO a u_llong :: Unmarshaller a -> Int -> LLong -> IO a u_string :: Unmarshaller a -> Int -> String -> IO a u_strings :: Unmarshaller a -> Int -> [String] -> IO a u_ptr :: Unmarshaller a -> Int -> Ptr () -> IO a u_writeFun :: Unmarshaller a -> Int -> WriteFunction -> IO a u_readFun :: Unmarshaller a -> Int -> ReadFunction -> IO a u_progressFun :: Unmarshaller a -> Int -> ProgressFunction -> IO a u_debugFun :: Unmarshaller a -> Int -> DebugFunction -> IO a u_posts :: Unmarshaller a -> Int -> [HttpPost] -> IO a u_sslctxt :: Unmarshaller a -> Int -> SSLCtxtFunction -> IO a u_ioctl_fun :: Unmarshaller a -> Int -> Ptr () -> IO a u_convFromNetwork :: Unmarshaller a -> Int -> Ptr () -> IO a u_convToNetwork :: Unmarshaller a -> Int -> Ptr () -> IO a u_convFromUtf8 :: Unmarshaller a -> Int -> Ptr () -> IO a u_sockoptFun :: Unmarshaller a -> Int -> Ptr () -> IO a verboseUnmarshaller :: Unmarshaller a -> Unmarshaller a u_bool :: Unmarshaller a -> Int -> Bool -> IO a u_enum :: Enum b => Unmarshaller a -> Int -> b -> IO a u_cptr :: Unmarshaller a -> Int -> Ptr CChar -> IO a showCurlOption :: CurlOption -> String instance Enum HttpVersion instance Show HttpVersion instance Enum TimeCond instance Show TimeCond instance Enum NetRcOption instance Show NetRcOption instance Enum HttpAuth instance Show HttpAuth instance Show SSHAuthType instance Eq DebugInfo instance Enum DebugInfo instance Show CurlOption -- | Haskell binding to the libcurl http://curl.haxx.se/ "easy" API. -- The "easy" API provides a higher-level, easy-to-get-started calling -- interface to the library's wide range of features for interacting with -- HTTP/FTP/etc servers. module Network.Curl.Easy -- | Initialise a curl instance initialize :: IO Curl perform :: Curl -> IO CurlCode setopt :: Curl -> CurlOption -> IO CurlCode duphandle :: Curl -> IO Curl reset :: Curl -> IO () curl_global_init :: CInt -> IO CurlCode curl_global_cleanup :: IO () curl_version_number :: IO Int curl_version_string :: IO String -- | A Haskell binding the libcurl library http://curl.haxx.se/, a -- proven and feature-rich library for interacting with HTTP(S)/FTP -- servers. -- -- The binding was initially made against version 7.16.2; libcurl does -- appear to be considerate in not introducing breaking changes wrt older -- versions. So, unless you're after the latest features (i.e., -- constructors towards the end the Option type), there's a very good -- chance your code will work against older installations of libcurl. module Network.Curl -- | Should be used once to wrap all uses of libcurl. WARNING: the argument -- should not return before it is completely done with curl (e.g., no -- forking or lazy returns) withCurlDo :: IO a -> IO a -- | Set a list of options on a Curl handle. setopts :: Curl -> [CurlOption] -> IO () -- | CurlResponse_ is a record type encoding all the information -- embodied in a response to your Curl request. Currently only used to -- gather up the results of doing a GET in curlGetResponse. data CurlResponse_ headerTy bodyTy CurlResponse :: CurlCode -> Int -> String -> headerTy -> bodyTy -> (Info -> IO InfoValue) -> CurlResponse_ headerTy bodyTy respCurlCode :: CurlResponse_ headerTy bodyTy -> CurlCode respStatus :: CurlResponse_ headerTy bodyTy -> Int respStatusLine :: CurlResponse_ headerTy bodyTy -> String respHeaders :: CurlResponse_ headerTy bodyTy -> headerTy respBody :: CurlResponse_ headerTy bodyTy -> bodyTy respGetInfo :: CurlResponse_ headerTy bodyTy -> (Info -> IO InfoValue) type CurlResponse = CurlResponse_ [(String, String)] String -- | curlGet perform a basic GET, dumping the output on stdout. The -- list of options are set prior performing the GET request. curlGet :: URLString -> [CurlOption] -> IO () -- | curlGetString performs the same request as curlGet, but -- returns the response body as a Haskell string. curlGetString :: URLString -> [CurlOption] -> IO (CurlCode, String) -- | Deprecated: Switch to using curlGetResponse_ curlGetResponse :: URLString -> [CurlOption] -> IO CurlResponse -- | Perform the actions already specified on the handle. Collects useful -- information about the returned message. Note that this function sets -- the CurlWriteFunction and CurlHeaderFunction options. -- | Deprecated: Consider switching to perform_with_response_ perform_with_response :: (CurlHeader hdrTy, CurlBuffer bufTy) => Curl -> IO (CurlResponse_ hdrTy bufTy) -- | Performs a curl request using an exisitng curl handle. The provided -- URL will overwride any CurlURL options that are provided in the -- list of options. See also: perform_with_response. -- | Deprecated: Consider switching to do_curl_ do_curl :: Curl -> URLString -> [CurlOption] -> IO CurlResponse curlGetString_ :: CurlBuffer ty => URLString -> [CurlOption] -> IO (CurlCode, ty) -- | curlGetResponse url opts performs a GET, returning -- all the info it can lay its hands on in the response, a value of type -- CurlResponse. The representation of the body is overloaded curlGetResponse_ :: (CurlHeader hdr, CurlBuffer ty) => URLString -> [CurlOption] -> IO (CurlResponse_ hdr ty) -- | Perform the actions already specified on the handle. Collects useful -- information about the returned message. Note that this function sets -- the CurlWriteFunction and CurlHeaderFunction options. -- The returned payload is overloaded over the representation of both -- headers and body via the CurlResponse_ type. perform_with_response_ :: (CurlHeader headerTy, CurlBuffer bodyTy) => Curl -> IO (CurlResponse_ headerTy bodyTy) do_curl_ :: (CurlHeader headerTy, CurlBuffer bodyTy) => Curl -> URLString -> [CurlOption] -> IO (CurlResponse_ headerTy bodyTy) -- | Get the headers associated with a particular URL. Returns the status -- line and the key-value pairs for the headers. curlHead_ :: CurlHeader headers => URLString -> [CurlOption] -> IO (String, headers) -- | Get the headers associated with a particular URL. Returns the status -- line and the key-value pairs for the headers. curlHead :: URLString -> [CurlOption] -> IO (String, [(String, String)]) -- | curlMultiPost perform a multi-part POST submission. curlMultiPost :: URLString -> [CurlOption] -> [HttpPost] -> IO () -- | curlPost performs. a common POST operation, namely that of -- submitting a sequence of name=value pairs. curlPost :: URLString -> [String] -> IO () getResponseCode :: Curl -> IO Int setDefaultSSLOpts :: Curl -> URLString -> IO () -- | Imports data into the Haskell world and invokes the callback. callbackWriter :: (String -> IO ()) -> WriteFunction easyWriter :: (String -> IO ()) -> WriteFunction -- | The output of Curl is ignored. This function does not marshall data -- into Haskell. ignoreOutput :: WriteFunction -- | Add chunks of data to an IORef as they arrive. gatherOutput :: IORef [String] -> WriteFunction -- | Add chunks of data to an IORef as they arrive. gatherOutput_ :: (CStringLen -> IO ()) -> WriteFunction -- | The CurlBuffer class encodes the representation of response -- buffers, allowing you to provide your own app-specific buffer reps to -- be used..or use one of the standard instances (String and -- ByteStrings.) class CurlBuffer bufferTy newIncoming :: CurlBuffer bufferTy => IO (IO bufferTy, CStringLen -> IO ()) -- | The CurlHeader class encodes the representation of response -- headers. Similar to CurlBuffer. class CurlHeader headerTy newIncomingHeader :: CurlHeader headerTy => IO (IO (String, headerTy), CStringLen -> IO ()) method_GET :: [CurlOption] method_HEAD :: [CurlOption] method_POST :: [CurlOption] parseStatusNHeaders :: String -> (String, [(String, String)]) parseHeader :: String -> (String, String) concRev :: [a] -> [[a]] -> [a] instance CurlBuffer ByteString instance CurlBuffer [ByteString] instance CurlBuffer ByteString instance CurlBuffer String instance CurlHeader [(String, String)]