http: fix handling of missing CURLPROTO_*

Commit aeae4db1 refactored the handling of the curl protocol restriction support into a function but failed to add a version check for older versions of curl that lack CURLPROTO_* support. Add the missing check and at the same time convert it to a feature check instead of a version based check. This is done to ensure that vendor supported curl versions that have had CURLPROTO_* support backported are handled correctly. Signed-off-by: Tom G. Christensen <tgc@jupiterrise.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Tom G. Christensen committed Aug 11, 2017 at 18:37 UTC f18777ba6ef23c30c68d2d4799b6ba512785288f
1 file changed +3 -1
http.c
+3 -1
@@ -677,6 +677,7 @@ void setup_curl_trace(CURL *handle)
677 curl_easy_setopt(handle, CURLOPT_DEBUGDATA, NULL);
678 }
679
680 +#ifdef CURLPROTO_HTTP
681 static long get_curl_allowed_protocols(int from_user)
682 {
683 long allowed_protocols = 0;
@@ -692,6 +693,7 @@ static long get_curl_allowed_protocols(int from_user)
693
694 return allowed_protocols;
695 }
696 +#endif
697
698 static CURL *get_curl_handle(void)
699 {
@@ -790,7 +792,7 @@ static CURL *get_curl_handle(void)
792 #elif LIBCURL_VERSION_NUM >= 0x071101
793 curl_easy_setopt(result, CURLOPT_POST301, 1);
794 #endif
793 -#if LIBCURL_VERSION_NUM >= 0x071304
795 +#ifdef CURLPROTO_HTTP
796 curl_easy_setopt(result, CURLOPT_REDIR_PROTOCOLS,
797 get_curl_allowed_protocols(0));
798 curl_easy_setopt(result, CURLOPT_PROTOCOLS,