From 071c56139463137a4e32a8d841a70c16f3682bb7 Mon Sep 17 00:00:00 2001 From: Frank Gevaerts Date: Wed, 11 May 2016 14:23:37 +0200 Subject: http: add CURLINFO_HTTP_VERSION and %{http_version} Adds access to the effectively used http version to both libcurl and curl. Closes #799 --- lib/getinfo.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib') diff --git a/lib/getinfo.c b/lib/getinfo.c index d4b01bf29..956a72454 100644 --- a/lib/getinfo.c +++ b/lib/getinfo.c @@ -198,6 +198,22 @@ static CURLcode getinfo_long(struct SessionHandle *data, CURLINFO info, case CURLINFO_RTSP_CSEQ_RECV: *param_longp = data->state.rtsp_CSeq_recv; break; + case CURLINFO_HTTP_VERSION: + switch (data->info.httpversion) { + case 10: + *param_longp = CURL_HTTP_VERSION_1_0; + break; + case 11: + *param_longp = CURL_HTTP_VERSION_1_1; + break; + case 20: + *param_longp = CURL_HTTP_VERSION_2_0; + break; + default: + *param_longp = CURL_HTTP_VERSION_NONE; + break; + } + break; default: return CURLE_UNKNOWN_OPTION; -- cgit v1.2.3