fix hostHeader

Former-commit-id: 819d2d7e5586db29ae3b17f508a1628279e4ad1f
Former-commit-id: c5ad3d9ec159cb74f3fd83dca475b5f5eec07795 [formerly 5287d88508ea3d26fa4a4ba865dbe685d239b387] [formerly b71451958c105f18759131bd3bae1acce0dfc7a6 [formerly cfd2af034bf7f1bdc8af0d57c7de1d550d933305 [formerly cfd2af034bf7f1bdc8af0d57c7de1d550d933305 [formerly cfd2af034bf7f1bdc8af0d57c7de1d550d933305 [formerly 28988dfd073570a24584c4085473c5d6d16c4546]]]]]
Former-commit-id: abbd350223f9031fc1f4462353ac5941e3924ca9 [formerly ca37ef24e864db46d9b1e17cced8b6c02057e789]
Former-commit-id: a199b4c4f570bf1ae74d6d4bc59b6d80a574ebda
Former-commit-id: d868bd1bdff3879acf70fdf0f081072bf7f0a761
Former-commit-id: 2b432e300f46149215057f8800a7cb9265b79c42
Former-commit-id: 50268e403572054fa0f7b6cfbef11fe2142ca9bf [formerly 6b51574ee7d27da59e50a59f1b09d5a3879300a5]
Former-commit-id: 661aff13225694c15480b6aeb61b8e222c7da19e
This commit is contained in:
Romain GERARD 2020-12-07 13:21:42 +01:00
parent 5d62604582
commit 38f40ef1b9

View file

@ -65,9 +65,10 @@ tunnelingClientP cfg@TunnelSettings{..} app conn = onError $ do
debug "Oppening Websocket stream"
stream <- connectionToStream conn
let headers = (if not (null upgradeCredentials) then [("Authorization", "Basic " <> B64.encode upgradeCredentials)] else [])
<> (if not (null hostHeader) then [("Host", hostHeader)] else [])
ret <- WS.runClientWithStream stream serverHost (toPath cfg) WS.defaultConnectionOptions headers run
let headers = if not (null upgradeCredentials) then [("Authorization", "Basic " <> B64.encode upgradeCredentials)] else []
let hostname = if not (null hostHeader) then (BC.unpack hostHeader) else serverHost
ret <- WS.runClientWithStream stream hostname (toPath cfg) WS.defaultConnectionOptions headers run
debug "Closing Websocket stream"
return ret