HTTP-4000.0.4: A library for client-side HTTPContentsIndex
Network.Browser
Portabilitynon-portable (not tested)
Stabilityexperimental
MaintainerSigbjorn Finne <sigbjorn.finne@gmail.com>
Description
An HTTP/1.1 compatible wrapper for the HTTP module.
Synopsis
data BrowserState connection
data BrowserAction conn a
data Cookie
data Form = Form RequestMethod URI [FormVar]
data Proxy
= NoProxy
| Proxy String (Maybe Authority)
browse :: BrowserAction conn a -> IO a
request :: HStream ty => Request ty -> BrowserAction (HandleStream ty) (URI, Response ty)
getBrowserState :: BrowserAction t (BrowserState t)
withBrowserState :: BrowserState t -> BrowserAction t a -> BrowserAction t a
setAllowRedirects :: Bool -> BrowserAction t ()
getAllowRedirects :: BrowserAction t Bool
data Authority
= AuthBasic {
auRealm :: String
auUsername :: String
auPassword :: String
auSite :: URI
}
| AuthDigest {
auRealm :: String
auUsername :: String
auPassword :: String
auNonce :: String
auAlgorithm :: Maybe Algorithm
auDomain :: [URI]
auOpaque :: Maybe String
auQop :: [Qop]
}
getAuthorities :: BrowserAction t [Authority]
setAuthorities :: [Authority] -> BrowserAction t ()
addAuthority :: Authority -> BrowserAction t ()
getAuthorityGen :: BrowserAction t (URI -> String -> IO (Maybe (String, String)))
setAuthorityGen :: (URI -> String -> IO (Maybe (String, String))) -> BrowserAction t ()
setAllowBasicAuth :: Bool -> BrowserAction t ()
setCookieFilter :: (URI -> Cookie -> IO Bool) -> BrowserAction t ()
defaultCookieFilter :: URI -> Cookie -> IO Bool
userCookieFilter :: URI -> Cookie -> IO Bool
getCookies :: BrowserAction t [Cookie]
setCookies :: [Cookie] -> BrowserAction t ()
addCookie :: Cookie -> BrowserAction t ()
setOutHandler :: (String -> IO ()) -> BrowserAction t ()
setEventHandler :: (BrowserEvent ty -> BrowserAction ty ()) -> BrowserAction ty ()
data BrowserEvent ty = BrowserEvent {
browserTimestamp :: ClockTime
browserRequestID :: RequestID
browserRequestURI :: String
browserEventType :: BrowserEventType ty
}
data BrowserEventType ty
= OpenConnection
| ReuseConnection
| RequestSent
| ResponseEnd ResponseData
| ResponseFinish
type RequestID = Int
setProxy :: Proxy -> BrowserAction t ()
setDebugLog :: Maybe String -> BrowserAction t ()
err :: String -> BrowserAction t ()
ioAction :: IO a -> BrowserAction t a
defaultGETRequest :: URI -> Request_String
defaultGETRequest_ :: BufferType a => URI -> Request a
formToRequest :: Form -> Request_String
uriDefaultTo :: URI -> URI -> URI
uriTrimHost :: URI -> URI
Documentation
data BrowserState connection
show/hide Instances
data BrowserAction conn a
show/hide Instances
data Cookie
show/hide Instances
data Form
Constructors
Form RequestMethod URI [FormVar]
data Proxy
Specifies if a proxy should be used for the request.
Constructors
NoProxyDon't use a proxy.
Proxy String (Maybe Authority)Use the proxy given. Should be of the form http://host:port, host, host:port, or http://host
browse :: BrowserAction conn a -> IO a
Apply a browser action to a state.
request :: HStream ty => Request ty -> BrowserAction (HandleStream ty) (URI, Response ty)
getBrowserState :: BrowserAction t (BrowserState t)
withBrowserState :: BrowserState t -> BrowserAction t a -> BrowserAction t a
setAllowRedirects :: Bool -> BrowserAction t ()
getAllowRedirects :: BrowserAction t Bool
data Authority
Constructors
AuthBasic
auRealm :: String
auUsername :: String
auPassword :: String
auSite :: URI
AuthDigest
auRealm :: String
auUsername :: String
auPassword :: String
auNonce :: String
auAlgorithm :: Maybe Algorithm
auDomain :: [URI]
auOpaque :: Maybe String
auQop :: [Qop]
getAuthorities :: BrowserAction t [Authority]
Interacting with browser state:
setAuthorities :: [Authority] -> BrowserAction t ()
addAuthority :: Authority -> BrowserAction t ()
getAuthorityGen :: BrowserAction t (URI -> String -> IO (Maybe (String, String)))
setAuthorityGen :: (URI -> String -> IO (Maybe (String, String))) -> BrowserAction t ()
setAllowBasicAuth :: Bool -> BrowserAction t ()
setCookieFilter :: (URI -> Cookie -> IO Bool) -> BrowserAction t ()
defaultCookieFilter :: URI -> Cookie -> IO Bool
userCookieFilter :: URI -> Cookie -> IO Bool
getCookies :: BrowserAction t [Cookie]
setCookies :: [Cookie] -> BrowserAction t ()
addCookie :: Cookie -> BrowserAction t ()
Adds a cookie to the browser state, removing duplicates.
setOutHandler :: (String -> IO ()) -> BrowserAction t ()
setEventHandler :: (BrowserEvent ty -> BrowserAction ty ()) -> BrowserAction ty ()
data BrowserEvent ty
BrowserEvent is the event record type that a user-defined handler, set via setEventHandler, will be passed. It indicates various state changes in the processing of a given Request ID.
Constructors
BrowserEvent
browserTimestamp :: ClockTime
browserRequestID :: RequestID
browserRequestURI :: String
browserEventType :: BrowserEventType ty
data BrowserEventType ty
BrowserEventType is the enumerated list of events that the browser internals will report to a user-defined event handler.
Constructors
OpenConnection
ReuseConnection
RequestSent
ResponseEnd ResponseData
ResponseFinish
type RequestID = Int
setProxy :: Proxy -> BrowserAction t ()
setDebugLog :: Maybe String -> BrowserAction t ()
err :: String -> BrowserAction t ()
ioAction :: IO a -> BrowserAction t a
Do an io action
defaultGETRequest :: URI -> Request_String
defaultGETRequest_ :: BufferType a => URI -> Request a
formToRequest :: Form -> Request_String
uriDefaultTo :: URI -> URI -> URI
Returns a URI that is consistent with the first argument uri when read in the context of a second. If second argument is not sufficient context for determining a full URI then anarchy reins.
uriTrimHost :: URI -> URI
Produced by Haddock version 2.3.0