Re: HTTP2: how to know the HTTP version used by libcurl
Date: Thu, 19 May 2016 12:40:54 +0530
I have created the patch for adding CURLINFO_HTTP_VERSION flag in
curl_easy_getinfo() function. Please find the attachment. Can you please
review it and let me know if there are any comments ?
On Tue, Apr 26, 2016 at 3:11 PM, Ganesh Nikam <gnikam_at_qualys.com> wrote:
> Hi Daniel,
> Thanks for the quick reply. I will check the code and if possible I will
> add the getinfo parameter.
> The 2nd point about answers my query. Similar to browsers (like firefox
> and chrome which support http/2 with HTTPS only), we can configure libcurl,
> using this HTTP version.
> Ganesh Nikam
> On Tue, Apr 26, 2016 at 2:57 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
>> 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
>> / daniel.haxx.se
>> List admin: https://cool.haxx.se/list/listinfo/curl-library
>> Etiquette: https://curl.haxx.se/mail/etiquette.html
- application/octet-stream attachment: curl-getinfo.patch