diff --git a/src/tool_operate.c b/src/tool_operate.c
index d5177d92b..e5506c6fa 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -956,9 +956,11 @@ static CURLcode operate_do(struct GlobalConfig *global,
/* new in libcurl 7.5 */
my_setopt(curl, CURLOPT_MAXREDIRS, config->maxredirs);
- /* new in libcurl 7.9.1 */
if(config->httpversion)
my_setopt_enum(curl, CURLOPT_HTTP_VERSION, config->httpversion);
+ else if(curlinfo->features & CURL_VERSION_HTTP2) {
+ my_setopt_enum(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2TLS);
+ }
/* new in libcurl 7.10.6 (default is Basic) */
if(config->authtype)
diff --git a/src/tool_setopt.c b/src/tool_setopt.c
index e11f527ac..ff8d40719 100644
--- a/src/tool_setopt.c
+++ b/src/tool_setopt.c
@@ -70,6 +70,8 @@ const NameValue setopt_nv_CURL_HTTP_VERSION[] = {
NV(CURL_HTTP_VERSION_NONE),
NV(CURL_HTTP_VERSION_1_0),
NV(CURL_HTTP_VERSION_1_1),
+ NV(CURL_HTTP_VERSION_2_0),
+ NV(CURL_HTTP_VERSION_2TLS),
NVEND,
};
diff --git a/tests/data/test1400 b/tests/data/test1400
index 72989c4c4..be458bd98 100644
--- a/tests/data/test1400
+++ b/tests/data/test1400
@@ -46,10 +46,11 @@ Accept: */*
s/(USERAGENT, \")[^\"]+/${1}stripped/
-# CURLOPT_SSL_VERIFYPEER and SSH_KNOWNHOSTS vary with configurations - just
-# ignore them
+# CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
+# configurations - just ignore them
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
+$_ = '' if /CURLOPT_HTTP_VERSION/
/********* Sample code generated by the curl command line tool **********
diff --git a/tests/data/test1401 b/tests/data/test1401
index d10cac26d..6144bd82d 100644
--- a/tests/data/test1401
+++ b/tests/data/test1401
@@ -53,10 +53,11 @@ X-Men: cyclops, iceman
-# CURLOPT_SSL_VERIFYPEER and SSH_KNOWNHOSTS vary with configurations - just
-# ignore them
+# CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
+# configurations - just ignore them
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
+$_ = '' if /CURLOPT_HTTP_VERSION/
/********* Sample code generated by the curl command line tool **********
diff --git a/tests/data/test1402 b/tests/data/test1402
index c3bf834bd..00395fc3c 100644
--- a/tests/data/test1402
+++ b/tests/data/test1402
@@ -51,10 +51,11 @@ foo=bar&baz=quux
# curl's default user-agent varies with version, libraries etc.
s/(USERAGENT, \")[^\"]+/${1}stripped/
-# CURLOPT_SSL_VERIFYPEER and SSH_KNOWNHOSTS vary with configurations - just
-# ignore them
+# CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
+# configurations - just ignore them
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
+$_ = '' if /CURLOPT_HTTP_VERSION/
/********* Sample code generated by the curl command line tool **********
diff --git a/tests/data/test1403 b/tests/data/test1403
index 3ec7dd032..85188d8f8 100644
--- a/tests/data/test1403
+++ b/tests/data/test1403
@@ -48,10 +48,11 @@ Accept: */*
# curl's default user-agent varies with version, libraries etc.
s/(USERAGENT, \")[^\"]+/${1}stripped/
-# CURLOPT_SSL_VERIFYPEER and SSH_KNOWNHOSTS vary with configurations - just
-# ignore them
+# CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
+# configurations - just ignore them
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
+$_ = '' if /CURLOPT_HTTP_VERSION/
/********* Sample code generated by the curl command line tool **********
diff --git a/tests/data/test1404 b/tests/data/test1404
index 441569752..0f59c496c 100644
--- a/tests/data/test1404
+++ b/tests/data/test1404
@@ -83,10 +83,11 @@ dummy data
# curl's default user-agent varies with version, libraries etc.
s/(USERAGENT, \")[^\"]+/${1}stripped/
-# CURLOPT_SSL_VERIFYPEER and SSH_KNOWNHOSTS vary with configurations - just
-# ignore them
+# CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
+# configurations - just ignore them
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
+$_ = '' if /CURLOPT_HTTP_VERSION/
/********* Sample code generated by the curl command line tool **********
diff --git a/tests/data/test1405 b/tests/data/test1405
index 38bfd5c54..5868afa58 100644
--- a/tests/data/test1405
+++ b/tests/data/test1405
@@ -127,10 +127,11 @@ int main(int argc, char *argv[])
# support, IOW depends on configuration - just ignore these.
$_ = '' if /CURLOPT_USERAGENT/
$_ = '' if /CURLOPT_MAXREDIRS/
-# CURLOPT_SSL_VERIFYPEER and SSH_KNOWNHOSTS vary with configurations - just
-# ignore them
+# CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
+# configurations - just ignore them
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
+$_ = '' if /CURLOPT_HTTP_VERSION/
diff --git a/tests/data/test1406 b/tests/data/test1406
index c80459f95..8c6de5c1a 100644
--- a/tests/data/test1406
+++ b/tests/data/test1406
@@ -116,10 +116,11 @@ int main(int argc, char *argv[])
# curl's default user-agent varies with version, libraries etc.
s/(USERAGENT, \")[^\"]+/${1}stripped/
-# CURLOPT_SSL_VERIFYPEER and SSH_KNOWNHOSTS vary with configurations - just
-# ignore them
+# CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
+# configurations - just ignore them
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
+$_ = '' if /CURLOPT_HTTP_VERSION/
diff --git a/tests/data/test1407 b/tests/data/test1407
index e84463a3e..8ec9b441e 100644
--- a/tests/data/test1407
+++ b/tests/data/test1407
@@ -94,10 +94,11 @@ int main(int argc, char *argv[])
# curl's default user-agent varies with version, libraries etc.
s/(USERAGENT, \")[^\"]+/${1}stripped/
-# CURLOPT_SSL_VERIFYPEER and SSH_KNOWNHOSTS vary with configurations - just
-# ignore them
+# CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
+# configurations - just ignore them
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
+$_ = '' if /CURLOPT_HTTP_VERSION/
diff --git a/tests/data/test1420 b/tests/data/test1420
index 79ca675a7..8894045d4 100644
--- a/tests/data/test1420
+++ b/tests/data/test1420
@@ -99,10 +99,11 @@ int main(int argc, char *argv[])
# curl's default user-agent varies with version, libraries etc.
s/(USERAGENT, \")[^\"]+/${1}stripped/
-# CURLOPT_SSL_VERIFYPEER and SSH_KNOWNHOSTS vary with configurations - just
-# ignore them
+# CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
+# configurations - just ignore them
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
+$_ = '' if /CURLOPT_HTTP_VERSION/