on master help sign in
Merge pull request #518 from helium/case-insensitve-multipart-headers

Case insensitive multipart request header lookup

commitad243e88f8cdb33b1ead27b2c93b321dce4c7c95 authorMichael Snoyman <michael@snoyman.com> dateThu 10 Mar 2016, 20:31 (11 years ago) parent7732e36af8be52
1 file changed+4−3
wai-extra/Network/Wai/Parse.hs+4−3
wai-extra/Network/Wai/Parse.hs+4−3
@@ -45,6 +45,7 @@ import Control.Monad (when, unless)
4545import Control.Monad.Trans.Resource (allocate, release, register, InternalState, runInternalState)
4646import Data.IORef
4747import Network.HTTP.Types (hContentType)
48+import Data.CaseInsensitive (mk)
4849
4950breakDiscard :: Word8 -> S.ByteString -> (S.ByteString, S.ByteString)
5051breakDiscard w s =
@@ -300,11 +301,11 @@ parsePieces sink bound rbody add =
300301 (wasFound, ()) <- sinkTillBound bound iter seed src
301302 when wasFound (loop src)
302303 where
303− contDisp = S8.pack "Content-Disposition"
304− contType = S8.pack "Content-Type"
304+ contDisp = mk $ S8.pack "Content-Disposition"
305+ contType = mk $ S8.pack "Content-Type"
305306 parsePair s =
306307 let (x, y) = breakDiscard 58 s -- colon
307− in (x, S.dropWhile (== 32) y) -- space
308+ in (mk $ x, S.dropWhile (== 32) y) -- space
308309
309310data Bound = FoundBound S.ByteString S.ByteString
310311 | NoBound