happstack-server 7.1.1 → 7.1.2
raw patch · 4 files changed
+22/−18 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- happstack-server.cabal +1/−1
- src/Happstack/Server/FileServe/BuildingBlocks.hs +1/−1
- src/Happstack/Server/Internal/Cookie.hs +1/−1
- src/Happstack/Server/Routing.hs +19/−15
happstack-server.cabal view
@@ -1,5 +1,5 @@ Name: happstack-server-Version: 7.1.1+Version: 7.1.2 Synopsis: Web related tools and services. Description: Happstack Server provides an HTTP server and a rich set of functions for routing requests, handling query parameters, generating responses, working with cookies, serving files, and more. For in-depth documentation see the Happstack Crash Course <http://happstack.com/docs/crashcourse/index.html> License: BSD3
src/Happstack/Server/FileServe/BuildingBlocks.hs view
@@ -624,7 +624,7 @@ if de then return Directory else return UnknownKind- return (fp, modTime, count, kind)+ return (if kind == Directory then (fp ++ "/") else fp, modTime, count, kind) -- | see 'serveDirectory' data Browsing
src/Happstack/Server/Internal/Cookie.hs view
@@ -99,7 +99,7 @@ s f = '\"' : concatMap e (f cookie) ++ "\"" e c | fctl c || c == '"' = ['\\',c] | otherwise = [c]- in concat $ intersperse ";" ((cookieName cookie++"="++s cookieValue):[ (k++v) | (k,v) <- l, "" /= v ] ++ + in concat $ intersperse ";" ((cookieName cookie++"="++s cookieValue):[ (k++v) | (k,v) <- l, "" /= v ] ++ (if secure cookie then ["Secure"] else []) ++ (if httpOnly cookie then ["HttpOnly"] else []))
src/Happstack/Server/Routing.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE FlexibleInstances, PatternGuards, ScopedTypeVariables, TypeSynonymInstances #-} -- | Route an incoming 'Request' to a handler. For more in-depth documentation see this section of the Happstack Crash Course: <http://happstack.com/docs/crashcourse/RouteFilters.html>-module Happstack.Server.Routing +module Happstack.Server.Routing ( -- * Route by scheme http , https@@ -35,7 +35,7 @@ -- | instances of this class provide a variety of ways to match on the 'Request' method. -- -- Examples:--- +-- -- > method GET -- match GET or HEAD -- > method [GET, POST] -- match GET, HEAD or POST -- > method HEAD -- match HEAD /but not/ GET@@ -124,12 +124,12 @@ -- > handler = -- > do methodM [GET, HEAD] -- > ...--- +-- -- NOTE: This function is largely retained for backwards -- compatibility. The fact that implicitly calls 'nullDir' is often -- forgotten and leads to confusion. It is probably better to just use -- 'method' and call 'nullDir' explicitly.--- +-- -- This function will likely be deprecated in the future. methodM :: (ServerMonad m, MonadPlus m, MatchMethod method) => method -> m () methodM meth = methodOnly meth >> nullDir@@ -153,7 +153,7 @@ -- -- > handler :: ServerPart Response -- > handler = methodSP [GET, HEAD] $ subHandler--- +-- -- NOTE: This style of combinator is going to be deprecated in the -- future. It is better to just use 'method'. --@@ -166,16 +166,16 @@ -- | guard which only succeeds if there are no remaining path segments -- -- Often used if you want to explicitly assign a route for '/'--- +-- nullDir :: (ServerMonad m, MonadPlus m) => m () nullDir = guardRq $ \rq -> null (rqPaths rq) -- | Pop a path element and run the supplied handler if it matches the -- given string.--- +-- -- > handler :: ServerPart Response -- > handler = dir "foo" $ dir "bar" $ subHandler--- +-- -- The path element can not contain \'/\'. See also 'dirs'. dir :: (ServerMonad m, MonadPlus m) => String -> m a -> m a dir staticPath handle =@@ -184,17 +184,17 @@ case rqPaths rq of (p:xs) | p == staticPath -> localRq (\newRq -> newRq{rqPaths = xs}) handle _ -> mzero- + -- | Guard against a 'FilePath'. Unlike 'dir' the 'FilePath' may -- contain \'/\'. If the guard succeeds, the matched elements will be -- popped from the directory stack. -- -- > dirs "foo/bar" $ ...--- +-- -- See also: 'dir'.-dirs :: (ServerMonad m, MonadPlus m) => FilePath -> m a -> m a -dirs fp m = - do let parts = splitDirectories (makeRelative "/" fp) +dirs :: (ServerMonad m, MonadPlus m) => FilePath -> m a -> m a+dirs fp m =+ do let parts = splitDirectories (makeRelative "/" fp) foldr dir m parts -- | Guard against the host.@@ -202,7 +202,11 @@ -- This matches against the @host@ header specified in the incoming 'Request'. -- -- Can be used to support virtual hosting, <http://en.wikipedia.org/wiki/Virtual_hosting>--- +--+-- Note that this matches against the value of the @Host@ header which may include the port number.+--+-- <http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23>+-- -- see also: 'withHost' host :: (ServerMonad m, MonadPlus m) => String -> m a -> m a host desiredHost handle =@@ -238,7 +242,7 @@ uriRest handle = askRq >>= handle . rqURL -- | Pop any path element and run the handler.--- +-- -- Succeeds if a path component was popped. Fails is the remaining path was empty. anyPath :: (ServerMonad m, MonadPlus m) => m r -> m r anyPath x = path $ (\(_::String) -> x)