aboutsummaryrefslogtreecommitdiff
path: root/lib/getinfo.c
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2016-05-11 14:23:37 +0200
committerDaniel Stenberg <daniel@haxx.se>2016-05-30 22:58:51 +0200
commit071c56139463137a4e32a8d841a70c16f3682bb7 (patch)
tree8731f8c08ce57c019fa23eb4bf7bea72ded13314 /lib/getinfo.c
parent4bffaad85f7ba9ba12272a06ce4e4a81a9a3178a (diff)
http: add CURLINFO_HTTP_VERSION and %{http_version}
Adds access to the effectively used http version to both libcurl and curl. Closes #799
Diffstat (limited to 'lib/getinfo.c')
-rw-r--r--lib/getinfo.c16
1 files changed, 16 insertions, 0 deletions
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;