# HG changeset patch # User Sebastien Jodogne # Date 1751899762 -7200 # Node ID 67dbb5004469bc09965db7a77dbf385247d8c4e1 # Parent 49991d8aef82599cf16981a2836c33afc0354b61 clarifying forbidden vs. unauthorized in class HttpServer diff -r 49991d8aef82 -r 67dbb5004469 OrthancFramework/Sources/HttpServer/HttpServer.cpp --- a/OrthancFramework/Sources/HttpServer/HttpServer.cpp Mon Jul 07 16:37:32 2025 +0200 +++ b/OrthancFramework/Sources/HttpServer/HttpServer.cpp Mon Jul 07 16:49:22 2025 +0200 @@ -621,7 +621,7 @@ enum AccessMode { - AccessMode_Forbidden, + AccessMode_NotAuthenticated, AccessMode_AuthorizationToken, AccessMode_RegisteredUser }; @@ -657,7 +657,7 @@ } } - return AccessMode_Forbidden; + return AccessMode_NotAuthenticated; } @@ -1241,9 +1241,9 @@ // Authenticate this connection if (server.IsAuthenticationEnabled() && - accessMode == AccessMode_Forbidden) + accessMode == AccessMode_NotAuthenticated) { - if (server.IsRedirectForbiddenToRoot() && + if (server.IsRedirectNotAuthenticatedToRoot() && uri.size() > 0) { // This is new in Orthanc 1.12.9 @@ -1326,7 +1326,7 @@ // filter. In the case of an authorization bearer token, grant // full access to the API. - assert(accessMode == AccessMode_Forbidden || // Could be the case if "!server.IsAuthenticationEnabled()" + assert(accessMode == AccessMode_NotAuthenticated || // Could be the case if "!server.IsAuthenticationEnabled()" accessMode == AccessMode_RegisteredUser); IIncomingHttpRequestFilter *filter = server.GetIncomingHttpRequestFilter(); @@ -1628,7 +1628,7 @@ threadsCount_(50), // Default value in mongoose/civetweb tcpNoDelay_(true), requestTimeout_(30), // Default value in mongoose/civetweb (30 seconds) - redirectForbiddenToRoot_(false) + redirectNotAuthenticatedToRoot_(false) { #if ORTHANC_ENABLE_MONGOOSE == 1 CLOG(INFO, HTTP) << "This Orthanc server uses Mongoose as its embedded HTTP server"; @@ -2233,15 +2233,15 @@ #endif - bool HttpServer::IsRedirectForbiddenToRoot() const + bool HttpServer::IsRedirectNotAuthenticatedToRoot() const { - return redirectForbiddenToRoot_; + return redirectNotAuthenticatedToRoot_; } - void HttpServer::SetRedirectForbiddenToRoot(bool redirect) + void HttpServer::SetRedirectNotAuthenticatedToRoot(bool redirect) { Stop(); - redirectForbiddenToRoot_ = redirect; + redirectNotAuthenticatedToRoot_ = redirect; } } diff -r 49991d8aef82 -r 67dbb5004469 OrthancFramework/Sources/HttpServer/HttpServer.h --- a/OrthancFramework/Sources/HttpServer/HttpServer.h Mon Jul 07 16:37:32 2025 +0200 +++ b/OrthancFramework/Sources/HttpServer/HttpServer.h Mon Jul 07 16:49:22 2025 +0200 @@ -114,7 +114,7 @@ unsigned int threadsCount_; bool tcpNoDelay_; unsigned int requestTimeout_; // In seconds - bool redirectForbiddenToRoot_; // New in Orthanc 1.12.9 + bool redirectNotAuthenticatedToRoot_; // New in Orthanc 1.12.9 #if ORTHANC_ENABLE_PUGIXML == 1 WebDavBuckets webDavBuckets_; @@ -228,8 +228,8 @@ const std::string& body, const std::string& boundary); - bool IsRedirectForbiddenToRoot() const; + bool IsRedirectNotAuthenticatedToRoot() const; - void SetRedirectForbiddenToRoot(bool redirect); + void SetRedirectNotAuthenticatedToRoot(bool redirect); }; }