-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A local http server to catch the HTTP redirect -- -- Manage an http server in your local PC to catch the HTTP redirect -- request from the browser. Especially, you can catch the redirect from -- oauth providor and will get oauth_verifier. @package reqcatcher @version 0.2.2.0 -- | Web.ReqCatcher starts a local HTTP server which handles just one -- request and returns that request to the client program. It is useful -- for CLI program to capture HTTP redirects from outer WEB services by -- using browser. -- --
-- import Web.Authenticate.OAuth
--
-- oauth :: OAuth
-- manager :: Manager
--
-- main :: IO ()
-- main = do
-- c <- newCatcher
-- let url = pack (catcherUrl c)
-- oauth' = oauth {oauthCallback = Just url}
--
-- credential <- getTemporaryCredential oauth' manager
-- putStrLn $ "Access to:\n" ++ (authorizeUrl oauth credential)
-- req <- catchRedirect c
--
-- let (Just (Just verifier)) = lookup "oauth_verifier" (queryString req)
-- ...
--
module Web.ReqCatcher
-- | Catcher holds the HTTP server instance and wait for a request.
data Catcher
-- | Creates the new Catcher instance.
newCatcher :: IO Catcher
-- | Creates the new Catcher instance with the specific port.
newCatcherWithPort :: Port -> IO Catcher
-- | Returns the HTTP request cought by Catcher. This function blocks until
-- Catcher catches some requests.
catchRedirect :: Catcher -> IO Request