on master help sign in
removing MIN_VERSION_http_types.
d9b4ce3Kazu Yamamoto
warp/Network/Wai/Handler/Warp/File.hs+2−20
@@ -23,10 +23,6 @@ import Network.Wai.Handler.Warp.Header
23import Network.Wai.Handler.Warp.PackInt
23import Network.Wai.Handler.Warp.PackInt
24import Numeric (showInt)
24import Numeric (showInt)
25
25
26−#ifndef MIN_VERSION_http_types
27−#define MIN_VERSION_http_types(x,y,z) 1
28−#endif
29−
30-- $setup
26-- $setup
31-- >>> import Test.QuickCheck
27-- >>> import Test.QuickCheck
32
28
@@ -116,17 +112,10 @@ checkRange (H.ByteRangeSuffix count) size = (max 0 (size - count), size - 1)
116
112
117----------------------------------------------------------------
113----------------------------------------------------------------
118
114
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−
126-- | @contentRangeHeader beg end total@ constructs a Content-Range 'H.Header'
115-- | @contentRangeHeader beg end total@ constructs a Content-Range 'H.Header'
127-- for the range specified.
116-- for the range specified.
128contentRangeHeader :: Integer -> Integer -> Integer -> H.Header
117contentRangeHeader :: Integer -> Integer -> Integer -> H.Header
129−contentRangeHeader beg end total = (contentRange, range)
118+contentRangeHeader beg end total = (H.hContentRange, range)
130 where
119 where
131 range = B.pack
120 range = B.pack
132 -- building with ShowS
121 -- building with ShowS
@@ -138,13 +127,6 @@ contentRangeHeader beg end total = (contentRange, range)
138 ( '/'
127 ( '/'
139 : showInt total "")
128 : showInt total "")
140
129
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−
148addContentHeaders :: H.ResponseHeaders -> Integer -> Integer -> Integer -> H.ResponseHeaders
130addContentHeaders :: H.ResponseHeaders -> Integer -> Integer -> Integer -> H.ResponseHeaders
149addContentHeaders hs off len size
131addContentHeaders hs off len size
150 | len == size = hs'
132 | len == size = hs'
@@ -152,7 +134,7 @@ addContentHeaders hs off len size
152 in ctrng:hs'
134 in ctrng:hs'
153 where
135 where
154 !lengthBS = packIntegral len
136 !lengthBS = packIntegral len
155− !hs' = (H.hContentLength, lengthBS) : (acceptRange,"bytes") : hs
137+ !hs' = (H.hContentLength, lengthBS) : (H.hAcceptRanges,"bytes") : hs
156
138
157-- |
139-- |
158--
140--
warp/Network/Wai/Handler/Warp/HTTP2/File.hs−4
@@ -22,10 +22,6 @@ import Numeric (showInt)
22import Network.HPACK
22import Network.HPACK
23import Network.HPACK.Token
23import Network.HPACK.Token
24
24
25−#ifndef MIN_VERSION_http_types
26−#define MIN_VERSION_http_types(x,y,z) 1
27−#endif
28−
29-- $setup
25-- $setup
30-- >>> import Test.QuickCheck
26-- >>> import Test.QuickCheck
31
27
warp/Network/Wai/Handler/Warp/Response.hs−10
@@ -18,10 +18,6 @@ module Network.Wai.Handler.Warp.Response (
18#define MIN_VERSION_base(x,y,z) 1
18#define MIN_VERSION_base(x,y,z) 1
19#endif
19#endif
20
20
21−#ifndef MIN_VERSION_http_types
22−#define MIN_VERSION_http_types(x,y,z) 1
23−#endif
24−
25import Blaze.ByteString.Builder.HTTP (chunkedTransferEncoding, chunkedTransferTerminator)
21import Blaze.ByteString.Builder.HTTP (chunkedTransferEncoding, chunkedTransferTerminator)
26#if __GLASGOW_HASKELL__ < 709
22#if __GLASGOW_HASKELL__ < 709
27import Control.Applicative
23import Control.Applicative
@@ -50,9 +46,7 @@ import Data.Streaming.Blaze (newBlazeRecv, reuseBufferStrategy)
50import Data.Version (showVersion)
46import Data.Version (showVersion)
51import Data.Word8 (_cr, _lf)
47import Data.Word8 (_cr, _lf)
52import qualified Network.HTTP.Types as H
48import qualified Network.HTTP.Types as H
53−#if MIN_VERSION_http_types(0,9,0)
54import qualified Network.HTTP.Types.Header as H
49import qualified Network.HTTP.Types.Header as H
55−#endif
56import Network.Wai
50import Network.Wai
57import Network.Wai.Handler.Warp.Buffer (toBuilderBuffer)
51import Network.Wai.Handler.Warp.Buffer (toBuilderBuffer)
58import qualified Network.Wai.Handler.Warp.Date as D
52import qualified Network.Wai.Handler.Warp.Date as D
@@ -411,11 +405,7 @@ hasBody s = sc /= 204
411----------------------------------------------------------------
405----------------------------------------------------------------
412
406
413addTransferEncoding :: H.ResponseHeaders -> H.ResponseHeaders
407addTransferEncoding :: H.ResponseHeaders -> H.ResponseHeaders
414−#if MIN_VERSION_http_types(0,9,0)
415addTransferEncoding hdrs = (H.hTransferEncoding, "chunked") : hdrs
408addTransferEncoding hdrs = (H.hTransferEncoding, "chunked") : hdrs
416−#else
417−addTransferEncoding hdrs = ("transfer-encoding", "chunked") : hdrs
418−#endif
419
409
420addDate :: IO D.GMTDate -> IndexedHeader -> H.ResponseHeaders -> IO H.ResponseHeaders
410addDate :: IO D.GMTDate -> IndexedHeader -> H.ResponseHeaders -> IO H.ResponseHeaders
421addDate getdate rspidxhdr hdrs = case rspidxhdr ! fromEnum ResDate of
411addDate getdate rspidxhdr hdrs = case rspidxhdr ! fromEnum ResDate of