@@ -90,6 +90,18 @@ static struct {
90
90
* here, too
91
91
*/
92
92
};
93
+ #if LIBCURL_VERSION_NUM >= 0x071600
94
+ static const char * curl_deleg ;
95
+ static struct {
96
+ const char * name ;
97
+ long curl_deleg_param ;
98
+ } curl_deleg_levels [] = {
99
+ { "none" , CURLGSSAPI_DELEGATION_NONE },
100
+ { "policy" , CURLGSSAPI_DELEGATION_POLICY_FLAG },
101
+ { "always" , CURLGSSAPI_DELEGATION_FLAG },
102
+ };
103
+ #endif
104
+
93
105
static struct credential proxy_auth = CREDENTIAL_INIT ;
94
106
static const char * curl_proxyuserpwd ;
95
107
static const char * curl_cookie_file ;
@@ -323,6 +335,15 @@ static int http_options(const char *var, const char *value, void *cb)
323
335
return 0 ;
324
336
}
325
337
338
+ if (!strcmp ("http.delegation" , var )) {
339
+ #if LIBCURL_VERSION_NUM >= 0x071600
340
+ return git_config_string (& curl_deleg , var , value );
341
+ #else
342
+ warning (_ ("Delegation control is not supported with cURL < 7.22.0" ));
343
+ return 0 ;
344
+ #endif
345
+ }
346
+
326
347
if (!strcmp ("http.pinnedpubkey" , var )) {
327
348
#if LIBCURL_VERSION_NUM >= 0x072c00
328
349
return git_config_pathname (& ssl_pinnedkey , var , value );
@@ -629,6 +650,22 @@ static CURL *get_curl_handle(void)
629
650
curl_easy_setopt (result , CURLOPT_HTTPAUTH , CURLAUTH_ANY );
630
651
#endif
631
652
653
+ #if LIBCURL_VERSION_NUM >= 0x071600
654
+ if (curl_deleg ) {
655
+ int i ;
656
+ for (i = 0 ; i < ARRAY_SIZE (curl_deleg_levels ); i ++ ) {
657
+ if (!strcmp (curl_deleg , curl_deleg_levels [i ].name )) {
658
+ curl_easy_setopt (result , CURLOPT_GSSAPI_DELEGATION ,
659
+ curl_deleg_levels [i ].curl_deleg_param );
660
+ break ;
661
+ }
662
+ }
663
+ if (i == ARRAY_SIZE (curl_deleg_levels ))
664
+ warning ("Unknown delegation method '%s': using default" ,
665
+ curl_deleg );
666
+ }
667
+ #endif
668
+
632
669
if (http_proactive_auth )
633
670
init_curl_http_auth (result );
634
671
0 commit comments