Permalink
Browse files

Updated for happstack 7.

* Removed dependency on happstack-util; depend on base64-bytestring
  instead.
  • Loading branch information...
1 parent 86599eb commit 8609002ac76323f2527fc58668306caf610a4d14 John MacFarlane committed Mar 29, 2012
Showing with 12 additions and 10 deletions.
  1. +10 −8 Network/Gitit/Framework.hs
  2. +2 −2 gitit.cabal
@@ -62,16 +62,16 @@ import Data.FileStore
import Data.Char (toLower)
import Control.Monad (mzero, liftM, unless, MonadPlus)
import qualified Data.Map as M
-import Data.ByteString.UTF8 (toString)
-import Data.ByteString.Lazy.UTF8 (fromString)
+import qualified Data.ByteString.UTF8 as UTF8
+import qualified Data.ByteString.Lazy.UTF8 as LazyUTF8
import Data.Maybe (fromJust, fromMaybe)
import Data.List (intercalate, isPrefixOf, isInfixOf)
import System.FilePath ((<.>), takeExtension, takeFileName)
import Text.Highlighting.Kate
import Text.ParserCombinators.Parsec
import Network.URL (decString, encString)
import Network.URI (isUnescapedInURI)
-import Happstack.Crypto.Base64 (decode)
+import Data.ByteString.Base64 (decodeLenient)
import Network.HTTP (urlEncodeVars)
-- | Require a logged in user if the authentication level demands it.
@@ -117,7 +117,7 @@ withUserFromHTTPAuth handler = do
req <- askRq
let user = case getHeader "authorization" req of
Nothing -> ""
- Just authHeader -> case parse pAuthorizationHeader "" (toString authHeader) of
+ Just authHeader -> case parse pAuthorizationHeader "" (UTF8.toString authHeader) of
Left _ -> ""
Right u -> u
localRq (setHeader "REMOTE_USER" user) handler
@@ -126,7 +126,7 @@ withUserFromHTTPAuth handler = do
getLoggedInUser :: GititServerPart (Maybe User)
getLoggedInUser = do
req <- askRq
- case maybe "" toString (getHeader "REMOTE_USER" req) of
+ case maybe "" UTF8.toString (getHeader "REMOTE_USER" req) of
"" -> return Nothing
u -> do
mbUser <- getUser u
@@ -148,7 +148,8 @@ pBasicHeader :: GenParser Char st String
pBasicHeader = do
_ <- string "Basic "
result' <- many (noneOf " \t\n")
- return $ takeWhile (/=':') $ decode result'
+ return $ takeWhile (/=':') $ UTF8.toString
+ $ decodeLenient $ UTF8.fromString result'
-- | @unlessNoEdit responder fallback@ runs @responder@ unless the
-- page has been designated not editable in configuration; in that
@@ -197,7 +198,7 @@ getReferer = do
req <- askRq
base' <- getWikiBase
return $ case getHeader "referer" req of
- Just r -> case toString r of
+ Just r -> case UTF8.toString r of
"" -> base'
s -> s
Nothing -> base'
@@ -327,7 +328,8 @@ withMessages messages handler = do
req <- askRq
let inps = filter (\(n,_) -> n /= "messages") $ rqInputsQuery req
let newInp = ("messages", Input {
- inputValue = Right $ fromString $ show messages
+ inputValue = Right
+ $ LazyUTF8.fromString $ show messages
, inputFilename = Nothing
, inputContentType = ContentType {
ctType = "text"
View
@@ -157,8 +157,8 @@ Executable gitit
filestore >= 0.4.0.2 && < 0.5,
zlib >= 0.5 && < 0.6,
url >= 2.1 && < 2.2,
- happstack-server >= 6.6 && < 6.7,
- happstack-util >= 6.0 && < 6.1,
+ happstack-server >= 6.6 && < 7.1,
+ base64-bytestring >= 0.1 && < 0.2,
xml >= 1.3.5,
hslogger >= 1 && < 1.2,
ConfigFile >= 1 && < 1.2,

0 comments on commit 8609002

Please sign in to comment.