]> granicus.if.org Git - curl/commitdiff
polarssl: fix ALPN protocol negotiation
authorAlessandro Ghedini <alessandro@ghedini.me>
Thu, 19 Feb 2015 18:55:59 +0000 (19:55 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 19 Feb 2015 22:07:40 +0000 (23:07 +0100)
Correctly check for strncmp() return value (it returns 0 if the strings
match).

lib/vtls/polarssl.c

index ca7e8077569b39928fd5c2b5af019f1f4028c4e2..5c7519735766a61bdcbbcb80f64eaa68a8e61880 100644 (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;
       }
     }