From ef30fa2fa98fa383501626dca0dd6097cbda42cc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 7 Jul 2025 16:41:19 -0400 Subject: [PATCH] support combineing --socket with HTTPs Might be useful when proxying? Dunno. --- Command/P2PHttp.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Command/P2PHttp.hs b/Command/P2PHttp.hs index 1463ec5dda..910b0151c5 100644 --- a/Command/P2PHttp.hs +++ b/Command/P2PHttp.hs @@ -188,13 +188,14 @@ runServer o mst = go `finally` serverShutdownCleanup mst Just socketpath -> withsocket socketpath $ \sock -> Warp.runSettingsSocket settings sock app - (Just certfile, Just privatekeyfile) -> + (Just certfile, Just privatekeyfile) -> do + let tlssettings = Warp.tlsSettingsChain + certfile (chainFileOption o) privatekeyfile case socketOption o of - Nothing -> do - let tlssettings = Warp.tlsSettingsChain - certfile (chainFileOption o) privatekeyfile - Warp.runTLS tlssettings settings app - Just _socketpath -> giveup "HTTPS is not supported with --socket" + Nothing -> Warp.runTLS tlssettings settings app + Just socketpath -> + withsocket socketpath $ \sock -> + Warp.runTLSSocket tlssettings settings sock app _ -> giveup "You must use both --certfile and --privatekeyfile options to enable HTTPS." port = maybe (fromIntegral defaultP2PHttpProtocolPort)