curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

RE: Compiling libcurl with HTTP/2 support in OpenWrt

From: Connor Ruggles via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 21 May 2019 15:06:45 +0000

Sorry for the very late reply, but I did as you said and ran this snippet:

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

And it printed a 0, so for some reason even though libcurl is being compiled with nghttp2 the support is not being added to my image. I verified with the Makefile as well in my local OpenWrt staging_dir for curl and it includes libnghttp2.

Also set curl to verbose and all HTTP requests are being sent as HTTP/1.1, so it's for sure not using HTTP/2. Do you have any other things I could try for this? I'm really at a loss.

-----Original Message-----
From: Daniel Stenberg <daniel_at_haxx.se>
Sent: Tuesday, December 11, 2018 5:46 AM
To: Connor Ruggles via curl-library <curl-library_at_cool.haxx.se>
Cc: Connor Ruggles <CRuggles_at_thinix.com>
Subject: Re: Compiling libcurl with HTTP/2 support in OpenWrt

On Mon, 10 Dec 2018, Connor Ruggles via curl-library wrote:

> I'm compiling OpenWrt with their imagebuilder and including libcurl,
> with the HTTP/2 option checked. So I'm covering my bases there, and I
> have validated it is attempting at least to use the nghttp2 library
> because when I remove the linked library objects, libcurl fails to
> make any requests and my program crashes.

Do you link with shared version of libcurl and nghttp2? If so, removing the libs should prevent your application from even starting since it can't link the libraries at run-time.

If you linked statically, then removing "the linked library objects" will not have any effect since they're already linked with your application.

> In my code, I have the HTTP version option as
> `CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE`. I have compiled the same
> version of curl on an Ubuntu machine with http2 support, and queried
> the same server that my program is querying, and my request is indeed
> upgraded to HTTP/2, so I know it's either a problem with the libcurl
> configuration on my device or a problem on the device itself.

At the end of curl's configure run it displays a summary of the build options and what features it will enable in the build etc. That should say that http2 is enabled. You can also use curl_version_info() [1] in your application to figure out exactly what your built libcurl supports. The 'features' bitmask has the CURL_VERSION_HTTP2 bit set when HTTP/2 support is present.

I would also recommend using CURLOPT_VERBOSE set to 1L when debugging your application so that you'll more details and information from libcurl about its doings.

[1] = https://curl.haxx.se/libcurl/c/curl_version_info.html

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2019-05-21