snapframework/snap-core — Issue #107: Route doesn't play nice with url-encoded path segments
Author: gregorycollins
Created: 2011-11-22 23:29:16+00:00
State: open

Sample failing program:

main :: IO ()
main = quickHttpServe $
ifTop (writeBS "hello world") <|>
route [ ("foo", writeBS "bar")
, ("echo/:echoparam/", echoHandler)
] <|>
dir "static" (serveDirectory ".")

echoHandler :: Snap ()
echoHandler = do
param <- getParam "echoparam"
maybe (writeBS "must specify echo/param in URL")
(\p -> do
writeBS "rqPathInfo: "
writeBS =<< liftM rqPathInfo getRequest
writeBS "\nparam: "
writeBS p)
param

Here `rqPathInfo` gets "%7D/" instead of "/" when you request "/echo/%7B3:5%7D/".