on master help sign in
adding necessary HeaderName.
commitad15865436da670c25f6b013c60a0ff96e453d89 authorKazu Yamamoto <kazu@iij.ad.jp> dateWed 15 Aug 2012, 12:42 (14 years ago) parent8b1a462
2 files changed+20−2
warp/Network/Wai/Handler/Warp/Request.hs+2−2 warp/Network/Wai/Handler/Warp/Types.hs+18
warp/Network/Wai/Handler/Warp/Request.hs+2−2
@@ -67,14 +67,14 @@ parseRequest' conn port (firstLine:otherLines) remoteHost' src = do
6767 heads <- liftIO
6868 $ handleExpect conn httpversion id
6969 (map parseHeaderNoAttr otherLines)
70− let host = fromMaybe host' $ lookup "host" heads
70+ let host = fromMaybe host' $ lookup hHost heads
7171 let len0 =
7272 case lookup H.hContentLength heads of
7373 Nothing -> 0
7474 Just bs -> readInt bs
7575 let serverName' = takeUntil 58 host -- ':'
7676 let chunked = maybe False ((== "chunked") . CI.foldCase)
77− $ lookup "transfer-encoding" heads
77+ $ lookup hTransferEncoding heads
7878 (rbody, getSource) <- liftIO $
7979 if chunked
8080 then do
warp/Network/Wai/Handler/Warp/Types.hs+18
@@ -1,4 +1,5 @@
11{-# LANGUAGE DeriveDataTypeable #-}
2+{-# LANGUAGE OverloadedStrings #-}
23
34module Network.Wai.Handler.Warp.Types where
45
@@ -7,14 +8,29 @@ import Data.ByteString (ByteString)
78import qualified Data.ByteString.Char8 as B
89import Data.Typeable (Typeable)
910import Data.Version (showVersion)
11+import Network.HTTP.Types.Header
1012import qualified Paths_warp
1113
14+----------------------------------------------------------------
15+
1216warpVersion :: String
1317warpVersion = showVersion Paths_warp.version
1418
19+----------------------------------------------------------------
20+
1521-- | TCP port number
1622type Port = Int
1723
24+----------------------------------------------------------------
25+
26+hTransferEncoding :: HeaderName
27+hTransferEncoding = "Transfer-Encoding"
28+
29+hHost :: HeaderName
30+hHost = "Host"
31+
32+----------------------------------------------------------------
33+
1834data InvalidRequest =
1935 NotEnoughLines [String]
2036 | BadFirstLine String
@@ -26,6 +42,8 @@ data InvalidRequest =
2642
2743instance Exception InvalidRequest
2844
45+----------------------------------------------------------------
46+
2947-- |
3048--
3149-- In order to provide slowloris protection, Warp provides timeout handlers. We