| 1387 | } |
| 1388 | |
| 1389 | void 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) |
no test coverage detected