Permalink
Browse files

Update for changes in network-2.4

  • Loading branch information...
1 parent ff019ac commit 7a266219284ff33d66fa5e3f67f406c2616feab5 @hsenag hsenag committed Sep 13, 2012
Showing with 21 additions and 3 deletions.
  1. +11 −2 HTTP.cabal
  2. +5 −1 Network/Browser.hs
  3. +5 −0 Network/HTTP/Auth.hs
View
@@ -59,6 +59,10 @@ Flag warn-as-error
default: False
description: Build with warnings-as-errors
+Flag network23
+ description: Use version 2.3.x or below of the network package
+ default: False
+
Library
Exposed-modules:
Network.BufferType,
@@ -81,7 +85,7 @@ Library
Network.HTTP.Utils
Paths_HTTP
GHC-options: -fwarn-missing-signatures -Wall
- Build-depends: base >= 2 && < 4.7, network, parsec
+ Build-depends: base >= 2 && < 4.7, parsec
Extensions: FlexibleInstances
if flag(old-base)
Build-depends: base < 3
@@ -92,6 +96,11 @@ Library
CPP-Options: -DMTL1
else
Build-depends: mtl >= 2.0 && < 2.2
+ if flag(network23)
+ Build-depends: network < 2.4
+ CPP-Options: -DNETWORK23
+ else
+ Build-depends: network >= 2.4 && < 2.5
if flag(warn-as-error)
ghc-options: -Werror
@@ -120,7 +129,7 @@ Test-Suite test
warp >= 1.2 && < 1.3,
pureMD5 >= 2.1 && < 2.2,
base >= 2 && < 4.6,
- network,
+ network < 2.5,
split >= 0.1 && < 0.2,
test-framework,
test-framework-hunit
View
@@ -913,7 +913,7 @@ request' nullVal rqState rq = do
}
rq2
where
- newURI_abs = maybe newURI id (newURI `relativeTo` uri)
+ newURI_abs = uriDefaultTo newURI uri
(3,0,5) ->
case retrieveHeaders HdrLocation rsp of
@@ -1035,7 +1035,11 @@ supportedScheme u = uriScheme u == "http:"
-- If the second argument is not sufficient context for determining
-- a full URI then anarchy reins.
uriDefaultTo :: URI -> URI -> URI
+#ifdef NETWORK23
uriDefaultTo a b = maybe a id (a `relativeTo` b)
+#else
+uriDefaultTo a b = a `relativeTo` b
+#endif
-- This form junk is completely untested...
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
-- |
-- Module : Network.HTTP.Auth
@@ -189,7 +190,11 @@ headerToChallenge baseURI (Header _ str) =
}
annotateURIs :: [Maybe URI] -> [URI]
+#ifdef NETWORK23
annotateURIs = (map (\u -> fromMaybe u (u `relativeTo` baseURI))) . catMaybes
+#else
+ annotateURIs = map (`relativeTo` baseURI) . catMaybes
+#endif
-- Change These:
readQop :: String -> [Qop]

0 comments on commit 7a26621

Please sign in to comment.