[PATCH v2 2/3] support force use http 1.1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Force Charlie <charlieio@xxxxxxxxxxx>

Signed-off-by: Force Charlie <charlieio@xxxxxxxxxxx>
---
 http.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/http.c b/http.c
index 99cb04faba..b2ec31aef5 100644
--- a/http.c
+++ b/http.c
@@ -48,7 +48,7 @@ char curl_errorstr[CURL_ERROR_SIZE];
 
 static int curl_ssl_verify = -1;
 static int curl_ssl_try;
-static int curl_http_version = 11;
+static int curl_http_version = 0;
 static const char *ssl_cert;
 static const char *ssl_cipherlist;
 static const char *ssl_version;
@@ -811,11 +811,14 @@ static CURL *get_curl_handle(void)
 		curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 2);
 	}
 
-#if LIBCURL_VERSION_NUM >= 0x073100
-	if(curl_http_version == 20){
-		/* CURL Enable HTTP2*/
-		curl_easy_setopt(result, CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_2);
-     }
+#if LIBCURL_VERSION_NUM >= 0x074700
+    // curl_http_version 0 is default.
+    if (curl_http_version == 20) {
+		/* Enable HTTP2 when request TLS*/
+		curl_easy_setopt(result, CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_2TLS);
+    } else if (curl_http_version == 11) {
+		curl_easy_setopt(result, CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_1);
+    }
 #endif
 
 #if LIBCURL_VERSION_NUM >= 0x070907
-- 
gitgitgadget




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux