[cpp-sp] branch main updated: Refactor handling of trailing slash in remoting URL.

Scott Cantor cantor.2 at osu.edu
Tue Oct 14 19:34:04 UTC 2025


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository cpp-sp.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=480a272a004b171341935250e01e4fee0b76521e

The following commit(s) were added to refs/heads/main by this push:
     new 480a272a Refactor handling of trailing slash in remoting URL.
480a272a is described below

commit 480a272a004b171341935250e01e4fee0b76521e
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Oct 14 15:34:00 2025 -0400

    Refactor handling of trailing slash in remoting URL.
---
 shibsp/remoting/impl/AbstractHTTPRemotingService.cpp | 8 ++++++--
 shibsp/remoting/impl/AbstractHTTPRemotingService.h   | 9 +++++++++
 shibsp/remoting/impl/WinHTTPRemotingService.cpp      | 6 ------
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/shibsp/remoting/impl/AbstractHTTPRemotingService.cpp b/shibsp/remoting/impl/AbstractHTTPRemotingService.cpp
index 1b4b407c..b1b50d52 100644
--- a/shibsp/remoting/impl/AbstractHTTPRemotingService.cpp
+++ b/shibsp/remoting/impl/AbstractHTTPRemotingService.cpp
@@ -47,7 +47,7 @@ const char AbstractHTTPRemotingService::CA_FILE_PROP_NAME[] = "tlsCAFile";
 const char AbstractHTTPRemotingService::REVOCATION_CHECK_PROP_NAME[] = "revocationCheck";
 
 const char AbstractHTTPRemotingService::SECRET_SOURCE_TYPE_PROP_DEFAULT[] = FILE_SECRET_SOURCE;
-const char AbstractHTTPRemotingService::BASE_URL_PROP_DEFAULT[] = "http://localhost:8080/idp/profile/sp";
+const char AbstractHTTPRemotingService::BASE_URL_PROP_DEFAULT[] = "http://localhost:8080/idp/profile/sp/";
 const char AbstractHTTPRemotingService::AUTH_METHOD_PROP_DEFAULT[] = "none";
 const char AbstractHTTPRemotingService::AUTH_CACHING_COOKIE_PROP_DEFAULT[] = "__Host-JSESSIONID";
 unsigned int AbstractHTTPRemotingService::CONNECT_TIMEOUT_PROP_DEFAULT = 3;
@@ -62,7 +62,11 @@ AbstractHTTPRemotingService::AbstractHTTPRemotingService(ptree& pt)
     props.load(pt);
 
     m_userAgent = props.getString(USER_AGENT_PROP_NAME, "");
-    m_baseURL = props.getString(BASE_URL_PROP_NAME, BASE_URL_PROP_DEFAULT);    
+    m_baseURL = props.getString(BASE_URL_PROP_NAME, BASE_URL_PROP_DEFAULT);
+    if (m_baseURL.back() != '/') {
+        m_baseURL += '/';
+    }
+
     m_authMethod = getAuthMethod(props.getString(AUTH_METHOD_PROP_NAME, AUTH_METHOD_PROP_DEFAULT));
     m_connectTimeout = props.getUnsignedInt(CONNECT_TIMEOUT_PROP_NAME, CONNECT_TIMEOUT_PROP_DEFAULT);
     m_timeout = props.getUnsignedInt(TIMEOUT_PROP_NAME, TIMEOUT_PROP_DEFAULT);
diff --git a/shibsp/remoting/impl/AbstractHTTPRemotingService.h b/shibsp/remoting/impl/AbstractHTTPRemotingService.h
index b569ecc7..75fc1947 100644
--- a/shibsp/remoting/impl/AbstractHTTPRemotingService.h
+++ b/shibsp/remoting/impl/AbstractHTTPRemotingService.h
@@ -61,7 +61,16 @@ namespace shibsp {
         };
 
         const SecretSource* getSecretSource(bool required=true) const;
+
+        /**
+         * Get the base URL for connection to the hub.
+         * 
+         * <p>This URL will end in a path separator (/).</p>
+         * 
+         * @return the base URL, with a terminating slash
+         */
         const char* getBaseURL() const;
+
         const char* getUserAgent() const;
         void setUserAgent(const char* ua);
         auth_t getAuthMethod() const;
diff --git a/shibsp/remoting/impl/WinHTTPRemotingService.cpp b/shibsp/remoting/impl/WinHTTPRemotingService.cpp
index b491a0c8..5844aa27 100644
--- a/shibsp/remoting/impl/WinHTTPRemotingService.cpp
+++ b/shibsp/remoting/impl/WinHTTPRemotingService.cpp
@@ -271,12 +271,6 @@ WinHTTPRemotingService::WinHTTPRemotingService(ptree& pt)
     //
     wstring wURL(utf8ToUtf16(getBaseURL()));
 
-    //
-    // Add a trailing back slash if needed
-    //
-    if (wURL.c_str()[wURL.size() - 1] != L'/')
-        wURL += L'/';
-
     //
     // Split it into little bits
     //

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list