1

As per this, in libcurl, the CURLOPT_SSL_ENABLE_ALPN option is enabled by default. For a project, I am trying to disable the ALPN extension, as below:

CURLcode res = CURLE_OK;
res = curl_easy_setopt(curl_, CURLOPT_SSL_ENABLE_ALPN, 0L);
if(res == CURLE_OK){
    cout<<"Set CURLOPT_SSL_ENABLE_ALPN to 0L res = "<<res;
}else{
    cout<<"Set CURLOPT_SSL_ENABLE_ALPN to 1L  res = "<<res<<"\t"<<curl_easy_strerror(res);
}

This is throwing me an error:

Set CURLOPT_SSL_ENABLE_ALPN to 1L  res = 48   An unknown option was passed in to libcurl

And, I can see ALPN extension present in TLS handshake, able to see it with Wireshark. How do I disable the ALPN extension? Openssl Version: OpenSSL 1.1.0k Curl Version: 7.67.0

2
  • Can you verify that your application is linking to a modern enough version of curl? Maybe it is picking up an older version somewhere.
    – Botje
    Dec 2, 2019 at 14:00
  • @Botje, mentioned curl version in the post is got directly from the library by using curl API, curl_version_info(CURLVERSION_NOW), also used ldd command to verify the same.
    – Shailesh
    Dec 3, 2019 at 6:25

2 Answers 2

1

In libcurl, all possible options are #define'd in the header, but it doesn't mean all are supported.

It looks like your libcurl was not built with HTTP2 support (libnghttp2).

For ALPN or NPN to actually work, curl_version_info() should include CURL_VERSION_HTTP2.

1
0

Apparently, if you don't compile with libcurl with HTTP2 support (libnghttp2), it is treating CURLOPT_SSL_ENABLE_ALPN and CURLOPT_SSL_ENABLE_NPN as unknown options, though ALPN and NPN are independent of HTTP2. It was a bug in libcurl. I had reported this behavior at libcurl github repo here, which they fixed it and fix will be available in next release.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.