Fix Http parsing error

portnov [2009-07-07 05:57:40]
Fix Http parsing error
Filename
Framework/Http/Httpd.hs
diff --git a/Framework/Http/Httpd.hs b/Framework/Http/Httpd.hs
index 30ae4ae..ddb627f 100644
--- a/Framework/Http/Httpd.hs
+++ b/Framework/Http/Httpd.hs
@@ -121,6 +121,7 @@ initServerMain processBody portNo callOut = do
       where
         readHeaders h mode uri = do
             lns <- readUntilEmptyLine h
+--             print lns
             case parseHeaders lns of
                 Right hdrs -> readPOST h mode uri hdrs
                 Left err   -> hClose h	-- strange format -- FIXME: arguable answer?
@@ -158,9 +159,13 @@ readUntilEmptyLine h = read' []
     where
       read' acc = do
           line <- hGetLine h
-          if null line
+          let line' = if (last line)=='\r'
+                        then init line
+                        else line
+--           print $ "read line:"++line'
+          if null line'
             then return acc
-            else read' (acc++[line])
+            else read' (acc++[line'])

 int2respCode :: Int -> ResponseCode
 int2respCode n =
ViewGit