diff options
author | Alessandro Ghedini <alessandro@ghedini.me> | 2015-02-19 19:55:59 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2015-02-19 23:07:40 +0100 |
commit | 633b3895d7a18ed8ddf3ae69dd08fe9eb1f0edb9 (patch) | |
tree | 2e218b7f21874e2812406731deb376263ae1e47f | |
parent | b723ec9905f0ddf4633d49059d92e384315d95a9 (diff) |
polarssl: fix ALPN protocol negotiation
Correctly check for strncmp() return value (it returns 0 if the strings
match).
-rw-r--r-- | lib/vtls/polarssl.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/vtls/polarssl.c b/lib/vtls/polarssl.c index ca7e80775..5c7519735 100644 --- a/lib/vtls/polarssl.c +++ b/lib/vtls/polarssl.c @@ -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; } } |