Route doesn't play nice with url-encoded path segments #107

Closed
gregorycollins opened this Issue Nov 22, 2011 · 0 comments

Projects

None yet

1 participant

@gregorycollins
Snap Framework member

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/".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment