curl-library
Re: HTTP2: how to know the HTTP version used by libcurl
Date: Tue, 26 Apr 2016 11:27:30 +0200 (CEST)
On Tue, 26 Apr 2016, Ganesh Nikam wrote:
> 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.
We really should provide a getinfo parameter for that! Are you interested in
helping us make that happen?
Right now the best way is probably to provide a header callback and parse out
the version yourself in the first response header. (By HTTP terminology it is
the status line and not a header, but it is passed to the header callback
nonetheless.)
> 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 ?
If you know you work with HTTPS then there's no difference between them. The
CURL_HTTP_VERSION_2TLS option is there for those who want to use both HTTP and
HTTPS URLs and have libcurl use HTTP/2 automatically only for the HTTPS ones.
It should also make it possible for libcurl to (at some point in the future)
perhaps switch to CURL_HTTP_VERSION_2TLS as default selected HTTP version.
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.htmlReceived on 2016-04-26