support combineing --socket with HTTPs

Might be useful when proxying? Dunno.
This commit is contained in:
Joey Hess 2025-07-07 16:41:19 -04:00
parent 492c484a82
commit ef30fa2fa9
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -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) ->
case socketOption o of
Nothing -> do
(Just certfile, Just privatekeyfile) -> do
let tlssettings = Warp.tlsSettingsChain
certfile (chainFileOption o) privatekeyfile
Warp.runTLS tlssettings settings app
Just _socketpath -> giveup "HTTPS is not supported with --socket"
case socketOption o of
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)