@@ -66,18 +66,19 @@ parseRequestLine s =
6666-- >>> parsePath "http://example.com:8080/path"
6767-- "/path"
6868-- >>> parsePath "http://example.com"
69−-- ""
69+-- "/"
7070-- >>> parsePath "/path"
7171-- "/path"
7272
7373-- FIXME: parsePath "http://example.com" should be "/"?
7474parsePath :: ByteString -> ByteString
7575parsePath path
76− | S.null path = "/"
77− | "http://" `S.isPrefixOf` path = extractPath path
78− | otherwise = path
76+ | "http://" `S.isPrefixOf` path = ensureNonEmpty $ extractPath path
77+ | otherwise = ensureNonEmpty $ path
7978 where
8079 extractPath = snd . S.breakByte 47 . S.drop 7 -- 47 is '/'.
80+ ensureNonEmpty "" = "/"
81+ ensureNonEmpty p = p
8182
8283----------------------------------------------------------------
8384