Skip to content
Closed
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: 6 additions & 16 deletions http/CurlUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1454,10 +1454,6 @@
*
* Authorization: Bearer edl_access_token
*
* - edl_echo_token: This soon to be legacy token is formed from
* the edl_auth_token and the server's EDL client_application_id.
* Echo-Token: edl_access_token:Client-Id
*
* If an aspirational auth header value is missing then that header
* will not be added to the request_headers list.
*
Expand All @@ -1468,25 +1464,19 @@
bool found;
string s;

s = BESContextManager::TheManager()->get_context(EDL_UID_KEY, found);
if (found && !s.empty()) {
request_headers = append_http_header(request_headers, "User-Id", s);
}
//s = BESContextManager::TheManager()->get_context(EDL_UID_KEY, found);
//if (found && !s.empty()) {
// request_headers = append_http_header(request_headers, "User-Id", s);
//}

Check warning on line 1470 in http/CurlUtils.cc

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the commented out code.

See more on https://sonarcloud.io/project/issues?id=opendap-bes&issues=AZ6vbxzTRD0Uh5IyO_kQ&open=AZ6vbxzTRD0Uh5IyO_kQ&pullRequest=1380

s = BESContextManager::TheManager()->get_context(EDL_AUTH_TOKEN_KEY, found);
if (found && !s.empty()) {
request_headers = append_http_header(request_headers, "Authorization", s);
}

s = BESContextManager::TheManager()->get_context(CMR_CLIENT_ID_CONTEXT_KEY, found);
if (found && !s.empty()) {
request_headers = append_http_header(request_headers, CMR_CLIENT_ID_KEY, s);
}

// TODO Remove this. See HYRAX-1036. jhrg 11/13/25
s = BESContextManager::TheManager()->get_context(EDL_ECHO_TOKEN_KEY, found);
s = BESContextManager::TheManager()->get_context(EDL_CLIENT_APPLICATION_ID_CONTEXT_KEY, found);
if (found && !s.empty()) {
request_headers = append_http_header(request_headers, "Echo-Token", s);
request_headers = append_http_header(request_headers, EDL_CLIENT_APPLICATION_ID_KEY, s);
}

return request_headers;
Expand Down
5 changes: 2 additions & 3 deletions http/HttpNames.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,11 @@
#define HTTP_URL_REFRESH_THRESHOLD 60

#define EDL_AUTH_TOKEN_KEY "edl_auth_token"
#define EDL_ECHO_TOKEN_KEY "edl_echo_token"
#define EDL_UID_KEY "uid"

// jhrg 11/13/25
#define CMR_CLIENT_ID_CONTEXT_KEY "edl_client_application_id"
#define CMR_CLIENT_ID_KEY "Client-Id"
#define EDL_CLIENT_APPLICATION_ID_CONTEXT_KEY "edl_client_application_id"

Check failure on line 78 in http/HttpNames.h

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace this macro by "const", "constexpr" or an "enum".

See more on https://sonarcloud.io/project/issues?id=opendap-bes&issues=AZ6vbxx8RD0Uh5IyO_kP&open=AZ6vbxx8RD0Uh5IyO_kP&pullRequest=1380
#define EDL_CLIENT_APPLICATION_ID_KEY "Client-Id"

#define REMOTE_RESOURCE_TMP_DIR_KEY "Http.RemoteResource.TmpDir" // default is /tmp/bes_rr_tmp
#define REMOTE_RESOURCE_DELETE_TMP_FILE "Http.RemoteResource.TmpFile.Delete" // default is true
Expand Down
22 changes: 8 additions & 14 deletions http/unit-tests/CurlUtilsTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,7 @@ class CurlUtilsTest : public CppUnit::TestFixture {
// happen even if exceptions are thrown by the add_edl...() test.
BESContextManager::TheManager()->unset_context(EDL_UID_KEY);
BESContextManager::TheManager()->unset_context(EDL_AUTH_TOKEN_KEY);
BESContextManager::TheManager()->unset_context(CMR_CLIENT_ID_CONTEXT_KEY);
// TODO Remove this and all instances of EDL_ECHO_TOKEN_KEY in this test suite.
// See HYRAX-1036. jhrg 11/13/25
BESContextManager::TheManager()->unset_context(EDL_ECHO_TOKEN_KEY);
BESContextManager::TheManager()->unset_context(EDL_CLIENT_APPLICATION_ID_CONTEXT_KEY);

// We have to remove the cookie file between test invocations.
// Not doing so can cause the previous test's login success
Expand Down Expand Up @@ -305,13 +302,13 @@ class CurlUtilsTest : public CppUnit::TestFixture {
DBG(cerr << prolog << "BEGIN\n");
curl_slist *hdrs = nullptr;
curl_slist *sl_iter;
string tokens[] = {"big_bucky_ball", "itsa_authy_token_time", "its_not_shrew"};
BESContextManager::TheManager()->set_context(EDL_UID_KEY, tokens[0]);
BESContextManager::TheManager()->set_context(EDL_AUTH_TOKEN_KEY, tokens[1]);
#if 0
BESContextManager::TheManager()->set_context(EDL_ECHO_TOKEN_KEY, tokens[2]);
#endif
BESContextManager::TheManager()->set_context(CMR_CLIENT_ID_CONTEXT_KEY, tokens[2]);

// string tokens[] = {"big_bucky_ball", "itsa_authy_token_time", "its_not_shrew"};
// BESContextManager::TheManager()->set_context(EDL_UID_KEY, tokens[0]);

string tokens[] = {"itsa_authy_token_time", "its_not_shrew"};
BESContextManager::TheManager()->set_context(EDL_AUTH_TOKEN_KEY, tokens[0]);
BESContextManager::TheManager()->set_context(EDL_CLIENT_APPLICATION_ID_CONTEXT_KEY, tokens[1]);

try {
hdrs = curl::add_edl_auth_headers(hdrs);
Expand Down Expand Up @@ -635,7 +632,6 @@ class CurlUtilsTest : public CppUnit::TestFixture {
edl_token};
BESContextManager::TheManager()->set_context(EDL_UID_KEY, tokens[0]);
BESContextManager::TheManager()->set_context(EDL_AUTH_TOKEN_KEY, tokens[1]);
BESContextManager::TheManager()->set_context(EDL_ECHO_TOKEN_KEY, tokens[2]);

auto redirect_url = curl::get_redirect_url(source_url);
DBG(cerr << prolog << "redirect_url: " << redirect_url->str() << "\n");
Expand Down Expand Up @@ -678,7 +674,6 @@ class CurlUtilsTest : public CppUnit::TestFixture {
edl_token};
BESContextManager::TheManager()->set_context(EDL_UID_KEY, tokens[0]);
BESContextManager::TheManager()->set_context(EDL_AUTH_TOKEN_KEY, tokens[1]);
BESContextManager::TheManager()->set_context(EDL_ECHO_TOKEN_KEY, tokens[2]);

try {
BES_STOPWATCH_START(MODULE, prolog + "Timing");
Expand Down Expand Up @@ -730,7 +725,6 @@ class CurlUtilsTest : public CppUnit::TestFixture {
edl_token};
BESContextManager::TheManager()->set_context(EDL_UID_KEY, tokens[0]);
BESContextManager::TheManager()->set_context(EDL_AUTH_TOKEN_KEY, tokens[1]);
BESContextManager::TheManager()->set_context(EDL_ECHO_TOKEN_KEY, tokens[2]);

// What matters here is that we assign cerr to the BESDebug output stream
DBG(BESDebug::SetUp("cerr,DUMMY_KEY"));
Expand Down
1 change: 0 additions & 1 deletion http/unit-tests/HttpErrorTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ class HttpErrorTest : public CppUnit::TestFixture {
// happen even if exceptions are thrown by the add_edl...() test.
BESContextManager::TheManager()->unset_context(EDL_UID_KEY);
BESContextManager::TheManager()->unset_context(EDL_AUTH_TOKEN_KEY);
BESContextManager::TheManager()->unset_context(EDL_ECHO_TOKEN_KEY);

// We have to remove the cookie file between test invocations.
// Not doing so can cause the previous test's login success
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class NgapApiTest : public CppUnit::TestFixture {

// Set the context for the client id. jhrg 10/8/25
const std::string test_client_id = "hyrax-test-client";
BESContextManager::TheManager()->set_context(CMR_CLIENT_ID_CONTEXT_KEY, test_client_id);
BESContextManager::TheManager()->set_context(EDL_CLIENT_APPLICATION_ID_CONTEXT_KEY, test_client_id);

string resty_path(
"/collections/C1443727145-LAADS/MOD08_D3.v6.1/granules/MOD08_D3.A2020308.061.2020309092644.hdf.nc");
Expand Down
16 changes: 1 addition & 15 deletions modules/hdf5_handler/h5gmcfdap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -722,24 +722,10 @@ void gen_gmh5_cfdmr(D4Group* d4_root,const HDF5CF::GMFile *f) {
string dods_extra = "DODS_EXTRA";

// If DODS_EXTRA exists, we will not create the unlimited dimensions.
if(d4_root->attributes() != nullptr) {

// TODO: The following lines cause seg. fault in libdap4, needs to investigate
// I still find segmentation fault even with the commented code. Something is not right.
#if 0
//if((d4_root->attributes()->find(dods_extra))==nullptr)
// This also causes the segmentation fault. The find() method may have flaw.
d4_attrs = d4_root->attributes();
if(d4_attrs->empty()==false) {
if((d4_attrs->find(dods_extra))==nullptr)
;
}
#endif
if((d4_root->attributes()->find(dods_extra))==nullptr) {

string unlimited_dim_names;

for (const auto &cvar:cvars) {

// Check unlimited dimension names.
for (const auto& dim:cvar->getDimensions()) {

Expand Down
Loading