]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl: use 2TLS by default
authorDaniel Stenberg <daniel@haxx.se>
Sun, 13 Dec 2015 08:24:08 +0000 (09:24 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 13 Dec 2015 08:26:43 +0000 (09:26 +0100)
Make this the default for the curl tool (if built with HTTP/2 powers
enabled) unless a specific HTTP version is requested on the command
line.

This should allow more users to get HTTP/2 powers without having to
change anything.

src/tool_operate.c
src/tool_setopt.c
tests/data/test1400
tests/data/test1401
tests/data/test1402
tests/data/test1403
tests/data/test1404
tests/data/test1405
tests/data/test1406
tests/data/test1407
tests/data/test1420

index d5177d92b58016cff33589a30aefcd9ba21d8ef1..e5506c6fa99569d29b30b1c165c8aad0c54fcb20 100644 (file)
@@ -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)
index e11f527ac443cacc8e409691518d84c8413a0f66..ff8d40719175f4548b5112170222d57b78aba2a5 100644 (file)
@@ -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,
 };
 
index 72989c4c4a807e952fe0d85e06382ab2e51ba120..be458bd98258406b6c73ca5b2e071413a8fbb428 100644 (file)
@@ -46,10 +46,11 @@ Accept: */*
 </protocol>
 <stripfile>
 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/
 </stripfile>
 <file name="log/test1400.c" mode="text">
 /********* Sample code generated by the curl command line tool **********
index d10cac26da19c8ec36650ae6c21e085a1c952629..6144bd82d33346c4670a6ca9bbf538d83c9b506a 100644 (file)
@@ -53,10 +53,11 @@ X-Men: cyclops, iceman
 \r
 </protocol>
 <stripfile>
-# 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/
 </stripfile>
 <file name="log/test1401.c" mode="text">
 /********* Sample code generated by the curl command line tool **********
index c3bf834bde30a3b9d8f31a32a30edf5aceb73c75..00395fc3c9474e346ec912c0851132128ba125d3 100644 (file)
@@ -51,10 +51,11 @@ foo=bar&baz=quux
 <stripfile>
 # 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/
 </stripfile>
 <file name="log/test1402.c" mode="text">
 /********* Sample code generated by the curl command line tool **********
index 3ec7dd032fd790ed687173bfccccf0dfb3ceee10..85188d8f87baa71d2cbecbab08a0be5db858722a 100644 (file)
@@ -48,10 +48,11 @@ Accept: */*
 <stripfile>
 # 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/
 </stripfile>
 <file name="log/test1403.c" mode="text">
 /********* Sample code generated by the curl command line tool **********
index 441569752b2e3f205b1083cf755cc54b48263a7f..0f59c496ca60518ac7c0dfc0ec03b9ea1174efb1 100644 (file)
@@ -83,10 +83,11 @@ dummy data
 <stripfile>
 # 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/
 </stripfile>
 <file name="log/test1404.c" mode="text">
 /********* Sample code generated by the curl command line tool **********
index 38bfd5c54d50e4d1eb0488a11b21abc7ccd098e5..5868afa582e5df8a133eb7bab5b50e3bd8444eaf 100644 (file)
@@ -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/
 </stripfile>
 </verify>
 </testcase>
index c80459f95b77eae2964c66312590aa7502dee92c..8c6de5c1a039b49270a9eb15d64303f780bd2c4c 100644 (file)
@@ -116,10 +116,11 @@ int main(int argc, char *argv[])
 <stripfile>
 # 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/
 </stripfile>
 </verify>
 </testcase>
index e84463a3e57dc5f8e0ceeecfba7657557fd351a0..8ec9b441e245b0aa6c6199abe5dcc1ecf69476ea 100644 (file)
@@ -94,10 +94,11 @@ int main(int argc, char *argv[])
 <stripfile>
 # 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/
 </stripfile>
 </verify>
 </testcase>
index 79ca675a7bf8846e0337c538d370d9a814acd175..8894045d4962ee2ab7b3d304757e982729cef99d 100644 (file)
@@ -99,10 +99,11 @@ int main(int argc, char *argv[])
 <stripfile>
 # 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/
 </stripfile>
 </verify>
 </testcase>