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

Function http_init

http.c:1389–1514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1387}
1388
1389void http_init(struct remote *remote, const char *url, int proactive_auth)
1390{
1391 char *normalized_url;
1392 struct urlmatch_config config = URLMATCH_CONFIG_INIT;
1393
1394 config.section = "http";
1395 config.key = NULL;
1396 config.collect_fn = http_options;
1397 config.cascade_fn = git_default_config;
1398 config.cb = NULL;
1399
1400 http_is_verbose = 0;
1401 normalized_url = url_normalize(url, &config.url);
1402
1403 repo_config(the_repository, urlmatch_config_entry, &config);
1404 free(normalized_url);
1405 string_list_clear(&config.vars, 1);
1406
1407 if (http_ssl_backend) {
1408 const curl_ssl_backend **backends;
1409 struct strbuf buf = STRBUF_INIT;
1410 int i;
1411
1412 switch (curl_global_sslset(-1, http_ssl_backend, &backends)) {
1413 case CURLSSLSET_UNKNOWN_BACKEND:
1414 strbuf_addf(&buf, _("Unsupported SSL backend '%s'. "
1415 "Supported SSL backends:"),
1416 http_ssl_backend);
1417 for (i = 0; backends[i]; i++)
1418 strbuf_addf(&buf, "\n\t%s", backends[i]->name);
1419 die("%s", buf.buf);
1420 case CURLSSLSET_NO_BACKENDS:
1421 die(_("Could not set SSL backend to '%s': "
1422 "cURL was built without SSL backends"),
1423 http_ssl_backend);
1424 case CURLSSLSET_TOO_LATE:
1425 die(_("Could not set SSL backend to '%s': already set"),
1426 http_ssl_backend);
1427 case CURLSSLSET_OK:
1428 break; /* Okay! */
1429 }
1430 }
1431
1432 if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
1433 die("curl_global_init failed");
1434
1435#ifdef GIT_CURL_HAVE_GLOBAL_TRACE
1436 {
1437 const char *comp = getenv("GIT_TRACE_CURL_COMPONENTS");
1438 if (comp)
1439 curl_global_trace(comp);
1440 }
1441#endif
1442
1443 if (proactive_auth && http_proactive_auth == PROACTIVE_AUTH_NONE)
1444 http_proactive_auth = PROACTIVE_AUTH_IF_CREDENTIALS;
1445
1446 if (remote && remote->http_proxy)

Callers 4

cmd_mainFunction · 0.85
cmd_mainFunction · 0.85
fetch_using_walkerFunction · 0.85
fetch_single_packfileFunction · 0.85

Calls 13

url_normalizeFunction · 0.85
string_list_clearFunction · 0.85
strbuf_addfFunction · 0.85
xstrdupFunction · 0.85
var_overrideFunction · 0.85
set_from_envFunction · 0.85
set_long_from_envFunction · 0.85
credential_from_urlFunction · 0.85
starts_withFunction · 0.85
get_curl_handleFunction · 0.85
repo_configFunction · 0.70

Tested by

no test coverage detected