Creating an image with libcurl with http2

Some version info first:
using the latest stable branch of the base firmware, 18,06.1
using latest versions of all relevant packages: libcurl, libnghttp2, and libmbedtls
device target is ramips/mt76x8
device packages is mipsel_24kc

I'm able to compile the image just fine, however when I make requests in a program on my device using libcurl it sends the request using http/1.1. I'm specifying the http version as 2 in my program and force enabling ALPN even though I know it's enabled by default. Why would my upgrade requests not be accepted? All other traffic to the same endpoint not from my program (a.k.a. from a browser) is using http/2, so I know the server is using http/2.

Do I need to compile libcurl locally? If so, how would I compile a version I can then link to my image builds?

Any insight to this would be greatly appreciated.

1 Like

HTTP2 does not seem to be selected by default in libcurl so I think you need to build your own.

Yes I did forget to say that in menuconfig I checked HTTP2 support under libcurl, so that's not the issue.

Just an update on testing: the issue is definitely not on the server side, I compiled curl on a different machine with http2 support and tested it manually, and the server does upgrade to http2 if requested. So this is definitely a problem on the device/with OpenWrt.

Were you able to solve this problem? Running into the same issue here.

Unfortunately no. For some more info, I ran this snippet:

printf("%d\n", curl_version_info(CURLVERSION_NOW)->features & CURL_VERSION_HTTP2);

and it printed 0, then ran:

printf("%d\n", curl_version_info(CURLVERSION_NOW)->features & CURL_VERSION_SSL);

and it printed 4. So even though I'm compiling my image with libcurl included, http2 support checked, and SSL support checked, only SSL is actually being included. However, there is a .so for both mbedtls AND libnghttp2.

Any help with this would be useful.

Have you tried latest version of curl and nghttp2? You can backport them from master branch

Yes, I did try that with no luck.