happstack-helpers-0.51: Convenience functions for Happstack.Source codeContentsIndex
Happstack.Helpers.ParseRequest
Synopsis
modRewriteAppUrl :: String -> Request -> Either String String
getHost :: Request -> Either String String
getHeaderVal :: String -> Request -> Either String String
getDomain :: Request -> Either String String
Documentation
modRewriteAppUrl :: String -> Request -> Either String StringSource
 case modRewriteAppUrl "tutorial/registered" of 
   Left e -> ...
   Right page -> ... 

Given a page path, try to return the home page of a happs server, basically, the host plus an optional path. At the same time, try to deal sanely with HAppS serving behind apache mod rewrite, a common situation for me at least because it lets you have multiple happs servers listening on different ports, all looking to the casual user like they are being served on port 80, and also unblocked by firewalls.

Can fail monadically

getHost :: Request -> Either String StringSource

getHost = getHeaderVal "host"

returns host with port numbers, if anything other than default 80

getHeaderVal :: String -> Request -> Either String StringSource
retrieve val of header for key supplied, or an error message if the key isn't found
getDomain :: Request -> Either String StringSource

host with port number stripped out, if any.

Useful, for example, for getting the right address to ssh to.

Produced by Haddock version 2.6.1