Commits

Bryan O'Sullivan  committed 7537c26

Be stricter about HTTP protocol version parsing.

  • Participants
  • Parent commits 781101b

Comments (0)

Files changed (1)

File examples/RFC2616.hs

 requestLine = do
   method <- P.takeWhile1 isToken <* skipHSpaces
   uri <- P.takeWhile1 (not . isHorizontalSpace) <* skipHSpaces <* string "HTTP/"
-  proto <- P.takeWhile1 isDigitOrDot <* endOfLine
+  proto <- P.takeWhile1 isHttpVersion <* endOfLine
   return $! Request method uri proto
  where
-  isDigitOrDot w = (w >= 48 && w <= 57) || w == 46
+  isHttpVersion w = w == 46 || w == 48 || w == 49
 
 data Header = Header {
       headerName  :: !B.ByteString