| 636 | } |
| 637 | |
| 638 | static 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 | |
| 669 | void http_reauth_prepare(int all_capabilities) |
| 670 | { |
no test coverage detected