Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(thirdparty): compile curl with gssapi #1683

Merged
merged 6 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/http/http_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,28 @@ dsn::error_s http_client::set_method(http_method method)
return dsn::error_s::ok();
}

dsn::error_s http_client::set_auth(http_auth_type authType)
{
switch (authType) {
case http_auth_type::SPNEGO:
RETURN_IF_SETOPT_NOT_OK(CURLOPT_HTTPAUTH, CURLAUTH_NEGOTIATE);
break;
case http_auth_type::DIGEST:
RETURN_IF_SETOPT_NOT_OK(CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
break;
case http_auth_type::BASIC:
RETURN_IF_SETOPT_NOT_OK(CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
break;
case http_auth_type::NONE:
break;
default:
RETURN_IF_SETOPT_NOT_OK(CURLOPT_HTTPAUTH, CURLAUTH_ANY);
break;
}

return dsn::error_s::ok();
}

dsn::error_s http_client::set_timeout(long timeout_ms)
{
RETURN_IF_SETOPT_NOT_OK(CURLOPT_TIMEOUT_MS, timeout_ms);
Expand Down
3 changes: 3 additions & 0 deletions src/http/http_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ class http_client
// Specify the maximum time in milliseconds that a request is allowed to complete.
dsn::error_s set_timeout(long timeout_ms);

// Specify the http auth type which include NONE BASIC DIGEST SPNEGO
dsn::error_s set_auth(http_auth_type authType);

// Operations for the header fields.
void clear_header_fields();
void set_accept(dsn::string_view val);
Expand Down
8 changes: 8 additions & 0 deletions src/http/http_method.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ enum class http_method
INVALID = 100,
};

enum class http_auth_type
{
NONE,
BASIC,
DIGEST,
SPNEGO,
};

ENUM_BEGIN(http_method, http_method::INVALID)
ENUM_REG2(http_method, GET)
ENUM_REG2(http_method, POST)
Expand Down
7 changes: 4 additions & 3 deletions thirdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,16 +283,17 @@ set(CURL_OPTIONS
--disable-manual
--disable-pop3
--disable-rtsp
--disable-shared
--disable-smtp
--disable-telnet
--disable-tftp
--disable-shared
--without-libidn
--without-librtmp
--without-zlib
--without-libssh2
--without-ssl
--without-libidn
--without-zlib
--without-zstd
--with-gssapi
)
if (APPLE)
set(CURL_OPTIONS
Expand Down
Loading