MCPcopy Index your code
hub / github.com/git/git / init_curl_http_auth

Function init_curl_http_auth

http.c:638–667  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

636}
637
638static void init_curl_http_auth(CURL *result)
639{
640 if ((!http_auth.username || !*http_auth.username) &&
641 (!http_auth.credential || !*http_auth.credential)) {
642 if (!always_auth_proactively() && curl_empty_auth_enabled()) {
643 curl_easy_setopt(result, CURLOPT_USERPWD, ":");
644 return;
645 } else if (!always_auth_proactively()) {
646 return;
647 } else if (http_proactive_auth == PROACTIVE_AUTH_BASIC) {
648 strvec_push(&http_auth.wwwauth_headers, "Basic");
649 }
650 }
651
652 credential_fill(the_repository, &http_auth, 1);
653
654 if (http_auth.password) {
655 if (always_auth_proactively()) {
656 /*
657 * We got a credential without an authtype and we don't
658 * know what's available. Since our only two options at
659 * the moment are auto (which defaults to basic) and
660 * basic, use basic for now.
661 */
662 curl_easy_setopt(result, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
663 }
664 curl_easy_setopt(result, CURLOPT_USERNAME, http_auth.username);
665 curl_easy_setopt(result, CURLOPT_PASSWORD, http_auth.password);
666 }
667}
668
669void http_reauth_prepare(int all_capabilities)
670{

Callers 2

get_curl_handleFunction · 0.85
get_active_slotFunction · 0.85

Calls 4

always_auth_proactivelyFunction · 0.85
curl_empty_auth_enabledFunction · 0.85
strvec_pushFunction · 0.85
credential_fillFunction · 0.85

Tested by

no test coverage detected