1From d7b970e46ba29a7e558e21d19f485977ffed6266 Mon Sep 17 00:00:00 2001 2From: Daniel Stenberg <daniel@haxx.se> 3Date: Fri, 29 Apr 2022 22:56:47 +0200 4Subject: [PATCH] http: move Curl_allow_auth_to_host() 5 6It was mistakenly put within the CURL_DISABLE_HTTP_AUTH #ifdef 7 8Reported-by: Michael Olbrich 9Fixes #8772 10Closes #8775 11--- 12 lib/http.c | 30 +++++++++++++++--------------- 13 1 file changed, 15 insertions(+), 15 deletions(-) 14 15diff --git a/lib/http.c b/lib/http.c 16index 0d5c449bc72a2..b215307dcaaa0 100644 17--- a/lib/http.c 18+++ b/lib/http.c 19@@ -651,6 +651,21 @@ CURLcode Curl_http_auth_act(struct Curl_easy *data) 20 return result; 21 } 22 23+/* 24+ * Curl_allow_auth_to_host() tells if authentication, cookies or other 25+ * "sensitive data" can (still) be sent to this host. 26+ */ 27+bool Curl_allow_auth_to_host(struct Curl_easy *data) 28+{ 29+ struct connectdata *conn = data->conn; 30+ return (!data->state.this_is_a_follow || 31+ data->set.allow_auth_to_other_hosts || 32+ (data->state.first_host && 33+ strcasecompare(data->state.first_host, conn->host.name) && 34+ (data->state.first_remote_port == conn->remote_port) && 35+ (data->state.first_remote_protocol == conn->handler->protocol))); 36+} 37+ 38 #ifndef CURL_DISABLE_HTTP_AUTH 39 /* 40 * Output the correct authentication header depending on the auth type 41@@ -775,21 +790,6 @@ output_auth_headers(struct Curl_easy *data, 42 return CURLE_OK; 43 } 44 45-/* 46- * Curl_allow_auth_to_host() tells if authentication, cookies or other 47- * "sensitive data" can (still) be sent to this host. 48- */ 49-bool Curl_allow_auth_to_host(struct Curl_easy *data) 50-{ 51- struct connectdata *conn = data->conn; 52- return (!data->state.this_is_a_follow || 53- data->set.allow_auth_to_other_hosts || 54- (data->state.first_host && 55- strcasecompare(data->state.first_host, conn->host.name) && 56- (data->state.first_remote_port == conn->remote_port) && 57- (data->state.first_remote_protocol == conn->handler->protocol))); 58-} 59- 60 /** 61 * Curl_http_output_auth() setups the authentication headers for the 62 * host/proxy and the correct authentication 63