on master help sign in
Paths_warp is included only in Response.hs.
commitc8a8f8c02353ce921acef6468903725c026d3fc1 authorKazu Yamamoto <kazu@iij.ad.jp> dateFri 1 Nov 2013, 13:21 (13 years ago) parentb376316
2 files changed+12−12
warp/Network/Wai/Handler/Warp/Response.hs+11 warp/Network/Wai/Handler/Warp/Types.hs+1−12
warp/Network/Wai/Handler/Warp/Response.hs+11
@@ -6,6 +6,8 @@
66module Network.Wai.Handler.Warp.Response (
77 sendResponse
88 , fileRange -- for testing
9+ , warpVersion
10+ , defaultServerValue
911 ) where
1012
1113import Blaze.ByteString.Builder (fromByteString, Builder, toByteStringIO, flush)
@@ -22,6 +24,7 @@ import Data.Conduit.Blaze (builderToByteString)
2224import qualified Data.Conduit.List as CL
2325import Data.Maybe (isJust, listToMaybe)
2426import Data.Monoid (mappend)
27+import Data.Version (showVersion)
2528import Network.HTTP.Attoparsec (parseByteRanges)
2629import qualified Network.HTTP.Types as H
2730import Network.Wai
@@ -31,6 +34,7 @@ import qualified Network.Wai.Handler.Warp.Timeout as T
3134import Network.Wai.Handler.Warp.Types
3235import Network.Wai.Internal
3336import Numeric (showInt)
37+import qualified Paths_warp
3438import qualified System.PosixCompat.Files as P
3539
3640----------------------------------------------------------------
@@ -306,6 +310,13 @@ addContentRange beg end total hdrs = (hContentRange, range) : hdrs
306310
307311----------------------------------------------------------------
308312
313+-- | The version of Warp.
314+warpVersion :: String
315+warpVersion = showVersion Paths_warp.version
316+
317+defaultServerValue :: HeaderValue
318+defaultServerValue = B.pack $ "Warp/" ++ warpVersion
319+
309320addServer :: IndexedHeader -> H.ResponseHeaders -> H.ResponseHeaders
310321addServer rspidxhdr hdrs = case rspidxhdr ! idxServer of
311322 Nothing -> (hServer, defaultServerValue) : hdrs
warp/Network/Wai/Handler/Warp/Types.hs+1−12
@@ -5,20 +5,12 @@
55module Network.Wai.Handler.Warp.Types where
66
77import Control.Exception
8−import Data.ByteString.Char8 (ByteString, pack)
8+import Data.ByteString (ByteString)
99import Data.Typeable (Typeable)
10−import Data.Version (showVersion)
1110import Network.HTTP.Types.Header
1211import Network.Socket (Socket)
1312import qualified Network.Wai.Handler.Warp.FdCache as F
1413import qualified Network.Wai.Handler.Warp.Timeout as T
15−import qualified Paths_warp
16−
17−----------------------------------------------------------------
18−
19−-- | The version of Warp.
20−warpVersion :: String
21−warpVersion = showVersion Paths_warp.version
2214
2315----------------------------------------------------------------
2416
@@ -42,9 +34,6 @@ hAcceptRanges = "Accept-Ranges"
4234hServer :: HeaderName
4335hServer = "Server"
4436
45−defaultServerValue :: HeaderValue
46−defaultServerValue = pack $ "Warp/" ++ warpVersion
47−
4837----------------------------------------------------------------
4938
5039-- | Error types for bad 'Request'.