Since commit
d4c51a4f5 ("MEDIUM: server: Make use of the stored ALPN
stored in the server"), the mux is installed before the handshake, from
the cached ALPN, for every SSL server with an ALPN, while this is only
needed to send early data. If the handshake then negotiates another
protocol, the wrong mux stays in place and the request ends in a 502.
Let's only do it for servers with "allow-0rtt". This should help with
github issue #3473, and must be backported to 3.3.
*/
if (IS_HTX_STRM(s) && srv->use_ssl &&
(srv->ssl_ctx.alpn_str || srv->ssl_ctx.npn_str)) {
- HA_RWLOCK_RDLOCK(SERVER_LOCK, &srv->path_params.param_lock);
- if (srv->path_params.srv_hash != hash || srv->path_params.nego_alpn[0] == 0)
+ if (!(srv->ssl_ctx.options & SRV_SSL_O_EARLY_DATA))
may_start_mux_now = 0;
- HA_RWLOCK_RDUNLOCK(SERVER_LOCK, &srv->path_params.param_lock);
+ else {
+ HA_RWLOCK_RDLOCK(SERVER_LOCK, &srv->path_params.param_lock);
+ if (srv->path_params.srv_hash != hash || srv->path_params.nego_alpn[0] == 0)
+ may_start_mux_now = 0;
+ HA_RWLOCK_RDUNLOCK(SERVER_LOCK, &srv->path_params.param_lock);
+ }
}
#endif /* TLSEXT_TYPE_application_layer_protocol_negotiation */