1
0
mirror of https://github.com/moparisthebest/curl synced 2025-03-11 07:39:50 -04:00

polarssl: fix ALPN protocol negotiation

Correctly check for strncmp() return value (it returns 0 if the strings
match).
This commit is contained in:
Alessandro Ghedini 2015-02-19 19:55:59 +01:00 committed by Daniel Stenberg
parent b723ec9905
commit 633b3895d7

View File

@ -468,11 +468,11 @@ polarssl_connect_step2(struct connectdata *conn,
if(next_protocol != NULL) {
infof(data, "ALPN, server accepted to use %s\n", next_protocol);
if(strncmp(next_protocol, NGHTTP2_PROTO_VERSION_ID,
if(!strncmp(next_protocol, NGHTTP2_PROTO_VERSION_ID,
NGHTTP2_PROTO_VERSION_ID_LEN)) {
conn->negnpn = NPN_HTTP2;
}
else if(strncmp(next_protocol, ALPN_HTTP_1_1, ALPN_HTTP_1_1_LENGTH)) {
else if(!strncmp(next_protocol, ALPN_HTTP_1_1, ALPN_HTTP_1_1_LENGTH)) {
conn->negnpn = NPN_HTTP1_1;
}
}