happstack-server 7.6.0 → 7.6.1
raw patch · 4 files changed
+12/−103 lines, 4 filesdep −template-haskelldep ~base64-bytestringdep ~networkPVP ok
version bump matches the API change (PVP)
Dependencies removed: template-haskell
Dependency ranges changed: base64-bytestring, network
API changes (from Hackage documentation)
Files
- happstack-server.cabal +4/−15
- src/Happstack/Server/Internal/Handler.hs +3/−3
- src/Happstack/Server/Internal/Socket.hs +5/−50
- src/Happstack/Server/Internal/SocketTH.hs +0/−35
happstack-server.cabal view
@@ -1,5 +1,5 @@ Name: happstack-server-Version: 7.6.0+Version: 7.6.1 Synopsis: Web related tools and services. Description: Happstack Server provides an HTTP server and a rich set of functions for routing requests, handling query parameters, generating responses, working with cookies, serving files, and more. For in-depth documentation see the Happstack Crash Course <http://happstack.com/docs/crashcourse/index.html> License: BSD3@@ -11,17 +11,12 @@ Build-Type: Simple Cabal-Version: >= 1.10 Extra-Source-Files: tests/Happstack/Server/Tests.hs README.md-tested-with: GHC==8.0.1, GHC==8.2.2, GHC==8.4.1, GHC==8.6.5, GHC==8.8.1+tested-with: GHC==8.0.1, GHC==8.2.2, GHC==8.4.1, GHC==8.6.5, GHC==8.8.3, GHC==8.10.1 source-repository head type: git location: https://github.com/Happstack/happstack-server.git -Flag template_haskell- Description: Template Haskell is available on this system- Default: True- Manual: False- flag network-uri description: Get Network.URI from the network-uri package default: True@@ -63,18 +58,17 @@ Other-modules: Happstack.Server.Internal.Clock Happstack.Server.Internal.LazyLiner- Happstack.Server.Internal.SocketTH Happstack.Server.SURI.ParseURI Paths_happstack_server if flag(network-uri)- build-depends: network > 2.6 && < 2.9 || >= 3.0.0 && < 3.2,+ build-depends: network >= 3.0.0 && < 3.2, network-bsd >= 2.8.1 && < 2.9, network-uri >= 2.6 && < 2.7 else build-depends: network < 2.6 Build-Depends: base >= 4 && < 5,- base64-bytestring == 1.0.*,+ base64-bytestring >= 1.0 && < 1.2, blaze-html >= 0.5 && < 0.10, bytestring, containers,@@ -94,7 +88,6 @@ system-filepath >= 0.3.1, syb, text >= 0.10 && < 1.3,- template-haskell < 2.16, time, threads >= 0.5, transformers >= 0.1.3 && < 0.6,@@ -103,10 +96,6 @@ utf8-string >= 0.3.4 && < 1.1, xhtml, zlib-- if flag(template_haskell)- cpp-options: -DTEMPLATE_HASKELL- other-extensions: TemplateHaskell hs-source-dirs: src
src/Happstack/Server/Internal/Handler.hs view
@@ -64,8 +64,8 @@ (rql, headerStr) <- required "failed to separate headers/body" $ splitAtCRLF topStr let (m,u,v) = requestLine rql headers' <- case parseHeaders "host" (L.unpack headerStr) of- Nothing -> Left "failed to parse host header"- Just x -> Right x+ Nothing -> Left "failed to parse host header"+ Just x -> Right x let headers = mkHeaders headers' let contentLen = fromMaybe 0 $ fmap fst (P.readInt =<< getHeaderUnsafe contentlengthC headers) (body, nextRequest) <- case () of@@ -143,7 +143,7 @@ let (_,code) = responseLine rsl headers' <- case parseHeaders "host" (L.unpack headerStr) of Nothing -> Left "failed to parse host header"- Just x -> Right x+ Just x -> Right x let headers = mkHeaders headers' let mbCL = fmap fst (B.readInt =<< getHeader "content-length" headers) (body,_) <-
src/Happstack/Server/Internal/Socket.hs view
@@ -1,7 +1,4 @@ {-# LANGUAGE CPP #-}-#ifdef TEMPLATE_HASKELL-{-# LANGUAGE TemplateHaskell #-}-#endif module Happstack.Server.Internal.Socket ( acceptLite , sockAddrToPeer@@ -9,13 +6,8 @@ import Data.List (intersperse) import Data.Word (Word32)-#ifdef TEMPLATE_HASKELL-import Happstack.Server.Internal.SocketTH(supportsIPv6)-import Language.Haskell.TH.Syntax-#endif- import qualified Network.Socket as S- ( Socket(..)+ ( Socket , PortNumber() , SockAddr(..) , HostName@@ -57,44 +49,7 @@ sockAddrToPeer :: S.SockAddr -> (S.HostName, S.PortNumber) sockAddrToPeer addr =-#ifdef TEMPLATE_HASKELL- $(if supportsIPv6- then- return $ CaseE (VarE (mkName "addr"))- [ Match- (ConP (mkName "S.SockAddrInet")- [VarP (mkName "p"),VarP (mkName "ha")])- (NormalB- (TupE- [(AppE (VarE (mkName "showHostAddress"))- (VarE (mkName "ha")))- , VarE (mkName "p")- ])) []- , Match (ConP (mkName "S.SockAddrInet6")- [VarP (mkName "p"),WildP,VarP (mkName "ha"),WildP])- (NormalB- (TupE- [ (AppE- (VarE (mkName "showHostAddress6"))- (VarE (mkName "ha")))- , VarE (mkName "p")- ])) []- , Match WildP- (NormalB (AppE (VarE (mkName "error"))- (LitE (StringL "Unsupported socket")))) []]- -- the above mess is the equivalent of this:- {-[| case addr of- (S.SockAddrInet p ha) -> (showHostAddress ha, p)- (S.SockAddrInet6 p _ ha _ ) -> (showHostAddress6 ha, p)- _ -> error "Unsupported socket"- |]-}- else- [| case addr of- (S.SockAddrInet p ha) -> (showHostAddress ha, p)- _ -> error "Unsupported socket"- |])-#else- case addr of- (S.SockAddrInet p ha) -> (showHostAddress ha, p)- _ -> error "Unsupported socket"-#endif+ case addr of+ (S.SockAddrInet p ha) -> (showHostAddress ha, p)+ (S.SockAddrInet6 p _ ha _) -> (showHostAddress6 ha, p)+ _ -> error "sockAddrToPeer: Unsupported socket type"
− src/Happstack/Server/Internal/SocketTH.hs
@@ -1,35 +0,0 @@-{-# LANGUAGE CPP #-}-#ifdef TEMPLATE_HASKELL-{-# LANGUAGE TemplateHaskell #-}-#endif-module Happstack.Server.Internal.SocketTH(supportsIPv6) where--#ifdef TEMPLATE_HASKELL-import Language.Haskell.TH-#endif--import Network.Socket(SockAddr(..))---- find out at compile time if the SockAddr6 / HostAddress6 constructors are available-supportsIPv6 :: Bool-#ifdef TEMPLATE_HASKELL-supportsIPv6 = $(let c = ["Network.Socket.SockAddrInet6", "Network.Socket.Internal.SockAddrInet6"] ; d = ''SockAddr- isInet6 :: Con -> Bool- isInet6 (NormalC n _) = show n `elem` c- isInet6 _ = False- in- do info <- reify d- case info of-#if MIN_VERSION_template_haskell(2,11,0)- TyConI (DataD _ _ _ _ cs _) ->-#else- TyConI (DataD _ _ _ cs _) ->-#endif- if any isInet6 cs- then [| True |]- else [| False |]- _ -> error "supportsIPv6: SockAddr is no longer a TyConI ?!?! Giving up."- )-#else-supportsIPv6 = False-#endif