]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/Authorization.hs
Honor cnfServerV4Addr and cnfServerV6Addr.
[Lucu.git] / Network / HTTP / Lucu / Authorization.hs
index bcc8003e408056a194f59c58ed876edb5a39bab1..8e1be587e9c4f25c93f2e581db594e249972d96f 100644 (file)
@@ -1,4 +1,4 @@
--- #prune
+{-# OPTIONS_HADDOCK prune #-}
 
 -- |Manipulation of WWW authorization.
 module Network.HTTP.Lucu.Authorization
@@ -13,6 +13,7 @@ module Network.HTTP.Lucu.Authorization
     where
 
 import qualified Codec.Binary.Base64 as B64
+import           Data.Maybe
 import           Network.HTTP.Lucu.Parser
 import           Network.HTTP.Lucu.Parser.Http
 import           Network.HTTP.Lucu.Utils
@@ -50,8 +51,8 @@ instance Show AuthChallenge where
 
 authCredentialP :: Parser AuthCredential
 authCredentialP = allowEOF $!
-                  do string "Basic"
-                     many1 lws
+                  do _   <- string "Basic"
+                     _   <- many1 lws
                      b64 <- many1
                             $ satisfy (\ c -> (c >= 'a' && c <= 'z') ||
                                               (c >= 'A' && c <= 'Z') ||
@@ -59,7 +60,7 @@ authCredentialP = allowEOF $!
                                               c == '+' ||
                                               c == '/' ||
                                               c == '=')
-                     let decoded = map (toEnum . fromEnum) (B64.decode b64)
+                     let decoded = map (toEnum . fromEnum) (fromJust $ B64.decode b64)
                      case break (== ':') decoded of
                        (uid, ':' : password)
                            -> return (BasicAuthCredential uid password)