cURL / Mailing Lists / curl-library / Single Mail

curl-library

HTTP2: how to know the HTTP version used by libcurl

From: Ganesh Nikam <gnikam_at_qualys.com>
Date: Tue, 26 Apr 2016 12:07:38 +0530

Hi All,

We want to use libcurl with HTTP/2 support. As per the details
regarding CURL_HTTP_VERSION_2_0
(https://curl.haxx.se/libcurl/c/CURLOPT_HTTP_VERSION.html), libcurl will
attempt to send HTTP/2 request using upgrade header. But if server is not
supporting HTTP/2, then it will fall back to HTTP 1.1 version. For HTTPS
requests the protocol negotiation will happen using ALPN. As per my
understanding the "fall back" mechanism for HTTP and ALPN for HTTPS are
internal to the libcurl. Application using libcurl will not have any idea
about this. I have some queries on these:

1. Is there any way to know the current HTTP version getting used in
libcurl requests ? I checked getinfo parameters but there is not parameter
for HTTP version ? In our application we want to know HTTP version getting
used for current requests.

2. If we have can send HTTPS requests by setting http version to
CURL_HTTP_VERSION_2_0,
then what is the purpose of CURL_HTTP_VERSION_2TLS ?

Regards
Ganesh Nikam

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-04-26