From 5d4f4aa61d360fcae3db31dbaa99ce6b610c3494 Mon Sep 17 00:00:00 2001 From: daidai <2017501503@qq.com> Date: Wed, 28 Aug 2024 21:06:00 +0800 Subject: [PATCH 1/2] [fix](ut)fix be enable_http_auth ut --- be/test/http/http_auth_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/be/test/http/http_auth_test.cpp b/be/test/http/http_auth_test.cpp index 6077f871b7076e..669538306fa848 100644 --- a/be/test/http/http_auth_test.cpp +++ b/be/test/http/http_auth_test.cpp @@ -73,7 +73,7 @@ TEST_F(HttpAuthTest, enable_all_http_auth) { { auto evhttp_req = evhttp_request_new(nullptr, nullptr); HttpRequest req2(evhttp_req); - auto auth = encode_basic_auth("doris", "passwd"); + auto auth = encode_basic_auth("root", ""); req2._headers.emplace(HttpHeaders::AUTHORIZATION, auth); EXPECT_EQ(s_auth_handler.on_header(&req2), -1); } @@ -82,7 +82,7 @@ TEST_F(HttpAuthTest, enable_all_http_auth) { { auto evhttp_req = evhttp_request_new(nullptr, nullptr); HttpRequest req3(evhttp_req); - auto auth = encode_basic_auth("doris", "passwd"); + auto auth = encode_basic_auth("root", ""); req3._headers.emplace(HttpHeaders::AUTHORIZATION, auth); req3._params.emplace("table", "T"); EXPECT_EQ(s_auth_handler.on_header(&req3), 0); From d344d5c16eec2fe35106c9f37c273146551fdf60 Mon Sep 17 00:00:00 2001 From: daidai <2017501503@qq.com> Date: Thu, 29 Aug 2024 00:20:27 +0800 Subject: [PATCH 2/2] fix encode_basic_auth error --- be/test/http/http_auth_test.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/be/test/http/http_auth_test.cpp b/be/test/http/http_auth_test.cpp index 669538306fa848..f39e61aa6e2cf7 100644 --- a/be/test/http/http_auth_test.cpp +++ b/be/test/http/http_auth_test.cpp @@ -73,8 +73,7 @@ TEST_F(HttpAuthTest, enable_all_http_auth) { { auto evhttp_req = evhttp_request_new(nullptr, nullptr); HttpRequest req2(evhttp_req); - auto auth = encode_basic_auth("root", ""); - req2._headers.emplace(HttpHeaders::AUTHORIZATION, auth); + req2._headers.emplace(HttpHeaders::AUTHORIZATION, "Basic cm9vdDo="); EXPECT_EQ(s_auth_handler.on_header(&req2), -1); } @@ -82,8 +81,7 @@ TEST_F(HttpAuthTest, enable_all_http_auth) { { auto evhttp_req = evhttp_request_new(nullptr, nullptr); HttpRequest req3(evhttp_req); - auto auth = encode_basic_auth("root", ""); - req3._headers.emplace(HttpHeaders::AUTHORIZATION, auth); + req3._headers.emplace(HttpHeaders::AUTHORIZATION, "Basic cm9vdDo="); req3._params.emplace("table", "T"); EXPECT_EQ(s_auth_handler.on_header(&req3), 0); evhttp_request_free(evhttp_req);