on master help sign in
Merge pull request #258 from sol/depend-on-http-types-0.8.5

Depend on http-types 0.8.5

commiteb7ba659cd9e84d0ac824f965c291376fc002ef0 authorKazu Yamamoto <kazu@iij.ad.jp> dateThu 5 Jun 2014, 16:18 (12 years ago) parent46b58099fd40c7
2 files changed+3−25
warp/Network/Wai/Handler/Warp/RequestHeader.hs+2−24 warp/warp.cabal+1−1
warp/Network/Wai/Handler/Warp/RequestHeader.hs+2−24
@@ -17,6 +17,7 @@ import Foreign.ForeignPtr (withForeignPtr)
1717import Foreign.Ptr (Ptr, plusPtr, minusPtr, nullPtr)
1818import Foreign.Storable (peek)
1919import qualified Network.HTTP.Types as H
20+import qualified Network.HTTP.Types.URI as H
2021import Network.Wai.Handler.Warp.Types
2122import qualified Network.HTTP.Types.Header as HH
2223-- $setup
@@ -35,7 +36,7 @@ parseHeaderLines :: [ByteString]
3536parseHeaderLines [] = throwIO $ NotEnoughLines []
3637parseHeaderLines (firstLine:otherLines) = do
3738 (method, path', query, httpversion) <- parseRequestLine firstLine
38− let path = parsePath path'
39+ let path = H.extractPath path'
3940 hdr = map parseHeader otherLines
4041 return (method, path', path, query, httpversion, hdr)
4142
@@ -114,29 +115,6 @@ parseRequestLine requestLine@(PS fptr off len) = withForeignPtr fptr $ \ptr -> d
114115
115116----------------------------------------------------------------
116117
117−-- |
118−--
119−-- >>> parsePath ""
120−-- "/"
121−-- >>> parsePath "http://example.com:8080/path"
122−-- "/path"
123−-- >>> parsePath "http://example.com"
124−-- "/"
125−-- >>> parsePath "/path"
126−-- "/path"
127−
128−-- FIXME: parsePath "http://example.com" should be "/"?
129−parsePath :: ByteString -> ByteString
130−parsePath path
131− | "http://" `S.isPrefixOf` path = ensureNonEmpty $ extractPath path
132− | otherwise = ensureNonEmpty path
133− where
134− extractPath = snd . S.breakByte 47 . S.drop 7 -- 47 is '/'.
135− ensureNonEmpty "" = "/"
136− ensureNonEmpty p = p
137−
138−----------------------------------------------------------------
139−
140118-- |
141119--
142120-- >>> parseHeader "Content-Length:47"
warp/warp.cabal+1−1
@@ -45,7 +45,7 @@ Library
4545 , conduit >= 0.5 && < 1.2
4646 , conduit-extra
4747 , ghc-prim
48− , http-types >= 0.7
48+ , http-types >= 0.8.5
4949 , lifted-base >= 0.1
5050 , network-conduit >= 0.5 && < 1.2
5151 , simple-sendfile >= 0.2.7 && < 0.3