Portability | non-portable (not tested) |
---|---|
Stability | experimental |
Maintainer | Sigbjorn Finne <sigbjorn.finne@gmail.com> |
Network.Browser
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
- 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 { }
- = AuthBasic {
- 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 ()
- setErrHandler :: (String -> IO ()) -> BrowserAction t ()
- setOutHandler :: (String -> IO ()) -> BrowserAction t ()
- setEventHandler :: (BrowserEvent ty -> BrowserAction ty ()) -> BrowserAction ty ()
- data BrowserEvent ty = BrowserEvent {}
- data BrowserEventType ty
- type RequestID = Int
- setProxy :: Proxy -> BrowserAction t ()
- setDebugLog :: Maybe String -> BrowserAction t ()
- out :: 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 Source
Instances
data BrowserAction conn a Source
Instances
Constructors
Specifies if a proxy should be used for the request.
Constructors
Don't use a proxy.
Use the proxy given. Should be of the form http://host:port, host, host:port, or http://host
browse :: BrowserAction conn a -> IO aSource
Apply a browser action to a state.
request :: HStream ty => Request ty -> BrowserAction (HandleStream ty) (URI, Response ty)Source
withBrowserState :: BrowserState t -> BrowserAction t a -> BrowserAction t aSource
setAllowRedirects :: Bool -> BrowserAction t () Source
Constructors
Fields
- auRealm :: String
- auUsername :: String
- auPassword :: String
- auSite :: URI
getAuthorities :: BrowserAction t [Authority]Source
Interacting with browser state:
setAuthorities :: [Authority] -> BrowserAction t () Source
addAuthority :: Authority -> BrowserAction t () Source
getAuthorityGen :: BrowserAction t (URI -> String -> IO (Maybe (String, String)))Source
setAuthorityGen :: (URI -> String -> IO (Maybe (String, String))) -> BrowserAction t () Source
setAllowBasicAuth :: Bool -> BrowserAction t () Source
setCookieFilter :: (URI -> Cookie -> IO Bool) -> BrowserAction t () Source
getCookies :: BrowserAction t [Cookie]Source
setCookies :: [Cookie] -> BrowserAction t () Source
addCookie :: Cookie -> BrowserAction t () Source
Adds a cookie to the browser state, removing duplicates.
setErrHandler :: (String -> IO ()) -> BrowserAction t () Source
setOutHandler :: (String -> IO ()) -> BrowserAction t () Source
setEventHandler :: (BrowserEvent ty -> BrowserAction ty ()) -> BrowserAction ty () Source
data BrowserEvent ty Source
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
Fields
data BrowserEventType ty Source
BrowserEventType
is the enumerated list of events that the browser
internals will report to a user-defined event handler.
setProxy :: Proxy -> BrowserAction t () Source
setDebugLog :: Maybe String -> BrowserAction t () Source
out :: String -> BrowserAction t () Source
err :: String -> BrowserAction t () Source
ioAction :: IO a -> BrowserAction t aSource
Do an io action
defaultGETRequest_ :: BufferType a => URI -> Request aSource
uriDefaultTo :: URI -> URI -> URI Source
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 Source