http: only send bearer if auth is allowed

Verify with test 2006

Closes #20843
This commit is contained in:
Daniel Stenberg 2026-03-06 23:13:07 +01:00
parent 1495489c41
commit e3d7401a32
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 100 additions and 1 deletions

View file

@ -705,6 +705,7 @@ static CURLcode output_auth_headers(struct Curl_easy *data,
if(authstatus->picked == CURLAUTH_BEARER) {
/* Bearer */
if(!proxy && data->set.str[STRING_BEARER] &&
Curl_auth_allowed_to_host(data) &&
!Curl_checkheaders(data, STRCONST("Authorization"))) {
auth = "Bearer";
result = http_output_bearer(data);