@@ -44,6 +44,7 @@ module Network.Wai.Handler.WarpTLS (
4444#if __GLASGOW_HASKELL__ < 709
4545import Control.Applicative ((<$>))
4646#endif
47+import Control.Applicative ((<|>))
4748import Control.Exception (Exception, throwIO, bracket, finally, handle, fromException, try, IOException, onException, SomeException(..))
4849import qualified Control.Exception as E
4950import Control.Monad (void)
@@ -279,7 +280,8 @@ runServeTLSSocket' tlsset@TLSSettings{..} set credential sock serve =
279280 }
280281 -- Adding alpn to user's tlsServerHooks.
281282 hooks = tlsServerHooks {
282− TLS.onALPNClientSuggest = Just alpn
283+ TLS.onALPNClientSuggest = TLS.onALPNClientSuggest tlsServerHooks <|>
284+ (if settingsHTTP2Enabled set then Just alpn else Nothing)
283285 }
284286 shared = def {
285287 TLS.sharedCredentials = TLS.Credentials [credential]