Portability | non-portable (not tested) |
---|---|
Stability | experimental |
Maintainer | bjorn@bringert.net |
An HTTP/1.1 compatible wrapper for the HTTP module.
- 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 ()
- 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
Show (BrowserState t) |
data BrowserAction conn a Source
Monad (BrowserAction conn) | |
Functor (BrowserAction conn) |
Form RequestMethod URI [FormVar] |
Specifies if a proxy should be used for the request.
NoProxy | Don'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 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
AuthBasic | |
| |
AuthDigest | |
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
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 -> URISource
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 -> URISource