Fix lesser used options
25b54dba775b31021a3a4677eb79e9771bcb97f7 missed several cases where we
had ifndef instead of ifdef. because these weren't the defaults, these
don't show up as failures when testing.
Tested: Redfish service validator passes. Inspection primarily.
Mechanical change.
Change-Id: I3f6915a97eb44d071795aed76476c6bee7e8ed27
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/http/http2_connection.hpp b/http/http2_connection.hpp
index efe66b6..446c38f 100644
--- a/http/http2_connection.hpp
+++ b/http/http2_connection.hpp
@@ -262,31 +262,30 @@
});
auto asyncResp =
std::make_shared<bmcweb::AsyncResp>(std::move(it->second.res));
-#ifndef BMCWEB_INSECURE_DISABLE_AUTHX
- thisReq.session = crow::authentication::authenticate(
- {}, asyncResp->res, thisReq.method(), thisReq.req, nullptr);
- if (!crow::authentication::isOnAllowlist(thisReq.url().path(),
- thisReq.method()) &&
- thisReq.session == nullptr)
+ if constexpr (!BMCWEB_INSECURE_DISABLE_AUTH)
{
- BMCWEB_LOG_WARNING("Authentication failed");
- forward_unauthorized::sendUnauthorized(
- thisReq.url().encoded_path(),
- thisReq.getHeaderValue("X-Requested-With"),
- thisReq.getHeaderValue("Accept"), asyncResp->res);
- }
- else
-#endif // BMCWEB_INSECURE_DISABLE_AUTHX
- {
- std::string_view expected = thisReq.getHeaderValue(
- boost::beast::http::field::if_none_match);
- BMCWEB_LOG_DEBUG("Setting expected hash {}", expected);
- if (!expected.empty())
+ thisReq.session = crow::authentication::authenticate(
+ {}, asyncResp->res, thisReq.method(), thisReq.req, nullptr);
+ if (!crow::authentication::isOnAllowlist(thisReq.url().path(),
+ thisReq.method()) &&
+ thisReq.session == nullptr)
{
- asyncResp->res.setExpectedHash(expected);
+ BMCWEB_LOG_WARNING("Authentication failed");
+ forward_unauthorized::sendUnauthorized(
+ thisReq.url().encoded_path(),
+ thisReq.getHeaderValue("X-Requested-With"),
+ thisReq.getHeaderValue("Accept"), asyncResp->res);
+ return 0;
}
- handler->handle(it->second.req, asyncResp);
}
+ std::string_view expected =
+ thisReq.getHeaderValue(boost::beast::http::field::if_none_match);
+ BMCWEB_LOG_DEBUG("Setting expected hash {}", expected);
+ if (!expected.empty())
+ {
+ asyncResp->res.setExpectedHash(expected);
+ }
+ handler->handle(it->second.req, asyncResp);
return 0;
}