summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Network/HTTP/Conduit.hs6
-rw-r--r--Network/HTTP/Conduit/Request.hs5
-rw-r--r--http-conduit.cabal4
-rw-r--r--test/main.hs5
4 files changed, 13 insertions, 7 deletions
diff --git a/Network/HTTP/Conduit.hs b/Network/HTTP/Conduit.hs
index 46143b6..6d6e59f 100644
--- a/Network/HTTP/Conduit.hs
+++ b/Network/HTTP/Conduit.hs
@@ -31,7 +31,11 @@
--
-- * Content-Length
--
--- * Host
+-- Note: In previous versions, the Host header would be set by this module in
+-- all cases. Starting from 1.6.1, if a Host header is present in
+-- @requestHeaders@, it will be used in place of the header this module would
+-- have generated. This can be useful for calling a server which utilizes
+-- virtual hosting.
--
-- Any network code on Windows requires some initialization, and the network
-- library provides withSocketsDo to perform it. Therefore, proper usage of
diff --git a/Network/HTTP/Conduit/Request.hs b/Network/HTTP/Conduit/Request.hs
index a0bc464..2e17280 100644
--- a/Network/HTTP/Conduit/Request.hs
+++ b/Network/HTTP/Conduit/Request.hs
@@ -248,7 +248,10 @@ requestBuilder req =
Just "" -> filter (\(k, _) -> k /= "Accept-Encoding")
Just _ -> id
- hostHeader = (("Host", hh):)
+ hostHeader x =
+ case lookup "Host" x of
+ Nothing -> ("Host", hh) : x
+ Just{} -> x
headerPairs :: W.RequestHeaders
headerPairs = hostHeader
diff --git a/http-conduit.cabal b/http-conduit.cabal
index d88c05d..a7b3603 100644
--- a/http-conduit.cabal
+++ b/http-conduit.cabal
@@ -1,5 +1,5 @@
name: http-conduit
-version: 1.6.0.4
+version: 1.6.1
license: BSD3
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
@@ -79,7 +79,7 @@ test-suite test
cpp-options: -DDEBUG
build-depends: base >= 4 && < 5
, HUnit
- , hspec
+ , hspec >= 1.3
, bytestring
, transformers
, failure
diff --git a/test/main.hs b/test/main.hs
index f6402b4..b78ffce 100644
--- a/test/main.hs
+++ b/test/main.hs
@@ -1,9 +1,8 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
-import Test.Hspec.Monadic
+import Test.Hspec
import qualified Data.ByteString as S
import qualified Data.ByteString.Char8 as S8
-import Test.Hspec.HUnit ()
import Test.HUnit
import Network.Wai hiding (requestBody)
import qualified Network.Wai
@@ -65,7 +64,7 @@ app req =
redir3 = (mk (fromString "Location"), fromString "/redir3")
main :: IO ()
-main = hspecX $ do
+main = hspec $ do
cookieTest
describe "simpleHttp" $ do
it "gets homepage" $ do