on master help sign in
removing MIN_VERSION_http_types.
commitd9b4ce3043ae5a2c1beb05ef6d577d388650d286 authorKazu Yamamoto <kazu@iij.ad.jp> dateTue 30 May 2017, 16:33 (9 years ago) parentbef8cb4
3 files changed+2−34
warp/Network/Wai/Handler/Warp/File.hs+2−20 warp/Network/Wai/Handler/Warp/HTTP2/File.hs−4 warp/Network/Wai/Handler/Warp/Response.hs−10
warp/Network/Wai/Handler/Warp/File.hs+2−20
@@ -23,10 +23,6 @@ import Network.Wai.Handler.Warp.Header
2323import Network.Wai.Handler.Warp.PackInt
2424import Numeric (showInt)
2525
26−#ifndef MIN_VERSION_http_types
27−#define MIN_VERSION_http_types(x,y,z) 1
28−#endif
29−
3026-- $setup
3127-- >>> import Test.QuickCheck
3228
@@ -116,17 +112,10 @@ checkRange (H.ByteRangeSuffix count) size = (max 0 (size - count), size - 1)
116112
117113----------------------------------------------------------------
118114
119−contentRange :: H.HeaderName
120−#if MIN_VERSION_http_types(0,9,0)
121−contentRange = H.hContentRange
122−#else
123−contentRange = "Content-Range"
124−#endif
125−
126115-- | @contentRangeHeader beg end total@ constructs a Content-Range 'H.Header'
127116-- for the range specified.
128117contentRangeHeader :: Integer -> Integer -> Integer -> H.Header
129−contentRangeHeader beg end total = (contentRange, range)
118+contentRangeHeader beg end total = (H.hContentRange, range)
130119 where
131120 range = B.pack
132121 -- building with ShowS
@@ -138,13 +127,6 @@ contentRangeHeader beg end total = (contentRange, range)
138127 ( '/'
139128 : showInt total "")
140129
141−acceptRange :: H.HeaderName
142−#if MIN_VERSION_http_types(0,9,0)
143−acceptRange = H.hAcceptRanges
144−#else
145−acceptRange = "Accept-Ranges"
146−#endif
147−
148130addContentHeaders :: H.ResponseHeaders -> Integer -> Integer -> Integer -> H.ResponseHeaders
149131addContentHeaders hs off len size
150132 | len == size = hs'
@@ -152,7 +134,7 @@ addContentHeaders hs off len size
152134 in ctrng:hs'
153135 where
154136 !lengthBS = packIntegral len
155− !hs' = (H.hContentLength, lengthBS) : (acceptRange,"bytes") : hs
137+ !hs' = (H.hContentLength, lengthBS) : (H.hAcceptRanges,"bytes") : hs
156138
157139-- |
158140--
warp/Network/Wai/Handler/Warp/HTTP2/File.hs−4
@@ -22,10 +22,6 @@ import Numeric (showInt)
2222import Network.HPACK
2323import Network.HPACK.Token
2424
25−#ifndef MIN_VERSION_http_types
26−#define MIN_VERSION_http_types(x,y,z) 1
27−#endif
28−
2925-- $setup
3026-- >>> import Test.QuickCheck
3127
warp/Network/Wai/Handler/Warp/Response.hs−10
@@ -18,10 +18,6 @@ module Network.Wai.Handler.Warp.Response (
1818#define MIN_VERSION_base(x,y,z) 1
1919#endif
2020
21−#ifndef MIN_VERSION_http_types
22−#define MIN_VERSION_http_types(x,y,z) 1
23−#endif
24−
2521import Blaze.ByteString.Builder.HTTP (chunkedTransferEncoding, chunkedTransferTerminator)
2622#if __GLASGOW_HASKELL__ < 709
2723import Control.Applicative
@@ -50,9 +46,7 @@ import Data.Streaming.Blaze (newBlazeRecv, reuseBufferStrategy)
5046import Data.Version (showVersion)
5147import Data.Word8 (_cr, _lf)
5248import qualified Network.HTTP.Types as H
53−#if MIN_VERSION_http_types(0,9,0)
5449import qualified Network.HTTP.Types.Header as H
55−#endif
5650import Network.Wai
5751import Network.Wai.Handler.Warp.Buffer (toBuilderBuffer)
5852import qualified Network.Wai.Handler.Warp.Date as D
@@ -411,11 +405,7 @@ hasBody s = sc /= 204
411405----------------------------------------------------------------
412406
413407addTransferEncoding :: H.ResponseHeaders -> H.ResponseHeaders
414−#if MIN_VERSION_http_types(0,9,0)
415408addTransferEncoding hdrs = (H.hTransferEncoding, "chunked") : hdrs
416−#else
417−addTransferEncoding hdrs = ("transfer-encoding", "chunked") : hdrs
418−#endif
419409
420410addDate :: IO D.GMTDate -> IndexedHeader -> H.ResponseHeaders -> IO H.ResponseHeaders
421411addDate getdate rspidxhdr hdrs = case rspidxhdr ! fromEnum ResDate of