Skip to content

Commit 5a3d70f

Browse files
committed
tls: replace NPN with ALPN for client connections
Signed-off-by: Biao Zhu <[email protected]>
1 parent 35885ce commit 5a3d70f

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

src/tls/openssl.c

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -198,21 +198,6 @@ static int tls_context_server_alpn_select_callback(SSL *ssl,
198198
return result;
199199
}
200200

201-
static int tls_context_client_alpn_select_callback(SSL *ssl,
202-
unsigned char **out,
203-
unsigned char *outlen,
204-
const unsigned char *in,
205-
unsigned int inlen,
206-
void *arg)
207-
{
208-
return tls_context_server_alpn_select_callback(ssl,
209-
(const unsigned char **) out,
210-
outlen,
211-
in,
212-
inlen,
213-
arg);
214-
}
215-
216201
int tls_context_alpn_set(void *ctx_backend, const char *alpn)
217202
{
218203
size_t wire_format_alpn_index;
@@ -283,10 +268,11 @@ int tls_context_alpn_set(void *ctx_backend, const char *alpn)
283268
ctx);
284269
}
285270
else {
286-
SSL_CTX_set_next_proto_select_cb(
287-
ctx->ctx,
288-
tls_context_client_alpn_select_callback,
289-
ctx);
271+
if (SSL_CTX_set_alpn_protos(ctx->ctx,
272+
(const unsigned char *) &ctx->alpn[1],
273+
(unsigned int)ctx->alpn[0]) != 0) {
274+
result = -1;
275+
}
290276
}
291277
}
292278

0 commit comments

Comments
 (0)