happstack-server 6.2.1 → 6.2.2
raw patch · 2 files changed
+16/−3 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Happstack.Server.Internal.TimeoutManager: cancel :: Handle -> IO ()
- Happstack.Server.Internal.TimeoutManager: pause :: Handle -> IO ()
- Happstack.Server.Internal.TimeoutManager: resume :: Handle -> IO ()
- Happstack.Server.Internal.TimeoutManager: tickle :: Handle -> IO ()
- Happstack.Server.SURI: escape :: String -> String
- Happstack.Server.SURI: unEscape :: String -> String
+ Happstack.Server.Internal.TimeoutManager: tickle, cancel, resume, pause :: Handle -> IO ()
+ Happstack.Server.SURI: escape, unEscape :: String -> String
Files
- happstack-server.cabal +1/−1
- src/Happstack/Server/RqData.hs +15/−2
happstack-server.cabal view
@@ -1,5 +1,5 @@ Name: happstack-server-Version: 6.2.1+Version: 6.2.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/RqData.hs view
@@ -60,6 +60,7 @@ import Control.Monad.Reader (ReaderT(ReaderT, runReaderT), MonadReader(ask, local), mapReaderT) import Control.Monad.Error (Error(noMsg, strMsg)) import Control.Monad.Trans (MonadIO(..))+import qualified Data.ByteString.Char8 as P import qualified Data.ByteString.Lazy.Char8 as L import qualified Data.ByteString.Lazy.UTF8 as LU import Data.Char (toLower)@@ -71,7 +72,8 @@ import qualified Data.Text.Lazy.Encoding as Text import Happstack.Server.Cookie (Cookie (cookieValue)) import Happstack.Server.Internal.Monads (ServerMonad(askRq, localRq), FilterMonad, WebMonad, ServerPartT, escape)-import Happstack.Server.Types (ContentType(..), Input(inputValue, inputFilename, inputContentType), Response, Request(rqInputsQuery, rqInputsBody, rqCookies, rqMethod), Method(POST,PUT), readInputsBody)+import Happstack.Server.Internal.RFC822Headers (parseContentType)+import Happstack.Server.Types (ContentType(..), Input(inputValue, inputFilename, inputContentType), Response, Request(rqInputsQuery, rqInputsBody, rqCookies, rqMethod), Method(POST,PUT), getHeader, readInputsBody) import Happstack.Server.Internal.MessageWrap (BodyPolicy(..), bodyInput, defaultBodyPolicy) import Happstack.Server.Response (internalServerError, requestEntityTooLarge, toResponse) @@ -144,8 +146,19 @@ instance (MonadIO m) => HasRqData (ServerPartT m) where askRqEnv = do rq <- askRq- mbi <- liftIO $ readInputsBody rq+ mbi <- liftIO $ if ((rqMethod rq == POST) || (rqMethod rq == PUT)) && (isDecodable (ctype rq))+ then readInputsBody rq+ else return (Just []) return (rqInputsQuery rq, mbi, rqCookies rq)+ where+ ctype :: Request -> Maybe ContentType+ ctype req = parseContentType . P.unpack =<< getHeader "content-type" req+ isDecodable :: Maybe ContentType -> Bool+ isDecodable Nothing = True -- assume it is application/x-www-form-urlencoded+ isDecodable (Just (ContentType "application" "x-www-form-urlencoded" _)) = True+ isDecodable (Just (ContentType "multipart" "form-data" ps)) = True+ isDecodable (Just _) = False+ rqDataError e = mzero localRqEnv f m = do rq <- askRq