on master help sign in
refactoring.
commitfecb6e97a48959ade8c03ef0ac22144443701715 authorKazu Yamamoto <kazu@iij.ad.jp> dateThu 3 Mar 2016, 14:19 (11 years ago) parent2d786b8
1 file changed+12−10
warp/Network/Wai/Handler/Warp/File.hs+12−10
warp/Network/Wai/Handler/Warp/File.hs+12−10
@@ -161,19 +161,21 @@ contentRangeHeader beg end total = (
161161 ( '/'
162162 : showInt total "")
163163
164−addContentHeaders :: H.ResponseHeaders -> Integer -> Integer -> Integer -> H.ResponseHeaders
165−addContentHeaders hs off len size = hs''
166− where
167− contentRange = contentRangeHeader off (off + len - 1) size
168− !lengthBS = B.pack $ show len
169− hs' = (H.hContentLength, lengthBS):(
164+acceptRange :: H.HeaderName
170165#if MIN_VERSION_http_types(0,9,0)
171− H.hAcceptRanges
166+acceptRange = H.hAcceptRanges
172167#else
173− "Accept-Ranges"
168+acceptRange = "Accept-Ranges"
174169#endif
175− , "bytes"):hs
176− hs'' = if len == size then hs' else contentRange:hs'
170+
171+addContentHeaders :: H.ResponseHeaders -> Integer -> Integer -> Integer -> H.ResponseHeaders
172+addContentHeaders hs off len size
173+ | len == size = hs'
174+ | otherwise = let !contentRange = contentRangeHeader off (off + len - 1) size
175+ in contentRange:hs'
176+ where
177+ !lengthBS = B.pack $ show len -- fixme
178+ !hs' = (H.hContentLength, lengthBS) : (acceptRange,"bytes") : hs
177179
178180-- |
179181--