--- #prune
+{-# OPTIONS_HADDOCK prune #-}
-- |Definition of things related on HTTP request.
--
requestP :: Parser Request
-requestP = do many crlf
+requestP = do _ <- many crlf
(method, uri, version) <- requestLineP
headers <- headersP
return Request {
requestLineP :: Parser (Method, URI, HttpVersion)
requestLineP = do method <- methodP
- sp
+ _ <- sp
uri <- uriP
- sp
+ _ <- sp
ver <- httpVersionP
- crlf
+ _ <- crlf
return (method, uri, ver)
methodP :: Parser Method
-methodP = (let methods = [ ("OPTIONS", OPTIONS)
- , ("GET" , GET )
- , ("HEAD" , HEAD )
- , ("POST" , POST )
- , ("PUT" , PUT )
- , ("DELETE" , DELETE )
- , ("TRACE" , TRACE )
- , ("CONNECT", CONNECT)
- ]
- in foldl (<|>) failP $ map (\ (str, mth)
- -> string str >> return mth) methods)
+methodP = ( let methods = [ ("OPTIONS", OPTIONS)
+ , ("GET" , GET )
+ , ("HEAD" , HEAD )
+ , ("POST" , POST )
+ , ("PUT" , PUT )
+ , ("DELETE" , DELETE )
+ , ("TRACE" , TRACE )
+ , ("CONNECT", CONNECT)
+ ]
+ in choice $ map (\ (str, mth)
+ -> string str >> return mth) methods )
<|>
- token >>= return . ExtensionMethod
+ fmap ExtensionMethod token
uriP :: Parser URI