[cpp-sp] branch main updated: Conditionally wrap request in Passthrough handler.

Codeberg noreply at shibboleth.net
Thu Nov 12 14:36:47 UTC 2026


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

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

View the commit online:
https://codeberg.org/Shibboleth/cpp-sp/commit/30b3e98a7c57edf45f9e22915f325b191e58afe8

The following commit(s) were added to refs/heads/main by this push:
     new 30b3e98a Conditionally wrap request in Passthrough handler.
30b3e98a is described below

commit 30b3e98a7c57edf45f9e22915f325b191e58afe8
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Thu Nov 12 09:36:22 2026 -0500

    Conditionally wrap request in Passthrough handler.
---
 shibsp/handler/impl/Passthrough.cpp | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/shibsp/handler/impl/Passthrough.cpp b/shibsp/handler/impl/Passthrough.cpp
index 39a53e12..44d49e75 100644
--- a/shibsp/handler/impl/Passthrough.cpp
+++ b/shibsp/handler/impl/Passthrough.cpp
@@ -49,6 +49,7 @@ namespace {
         set<string> m_remotedHeaders;
         vector<string> m_requestMapperSettings;
         vector<string> m_querySettings;
+        bool m_wrapRequest;
         bool m_body;
         bool m_limitRedirects;
     };
@@ -65,12 +66,14 @@ Passthrough::Passthrough(const ptree& pt, const char* path)
 {
     static const char OPERATION_PROP_NAME[] = "operation";
     static const char REMOTED_HEADERS_PROP_NAME[] = "remotedHeaders";
+    static const char WRAP_REQUEST_PROP_NAME[] = "wrapRequest";
     static const char SEND_BODY_PROP_NAME[] = "sendBody";
     static const char LIMIT_REDIRECTS_PROP_NAME[] = "limitRedirects";
     static const char REQUEST_MAPPER_SETTINGS_PROP_NAME[] = "requestMapperSettings";
     static const char QUERY_SETTINGS_PROP_NAME[] = "querySettings";
 
     static const char OPERATION_PROP_DEFAULT[] = "";
+    static bool WRAP_REQUEST_PROP_DEFAULT = false;
     static bool SEND_BODY_PROP_DEFAULT = false;
     static bool LIMIT_REDIRECTS_PROP_DEFAULT = true;
 
@@ -79,11 +82,17 @@ Passthrough::Passthrough(const ptree& pt, const char* path)
         throw ConfigurationException("Passthrough handler missing required operation setting.");
     }
 
-    const char* headers = getString(REMOTED_HEADERS_PROP_NAME);
-    if (headers) {
-        split_to_container(m_remotedHeaders, headers);
+    m_wrapRequest = getBool(WRAP_REQUEST_PROP_NAME, WRAP_REQUEST_PROP_DEFAULT);
+    if (m_wrapRequest) {
+        const char* headers = getString(REMOTED_HEADERS_PROP_NAME);
+        if (headers) {
+            split_to_container(m_remotedHeaders, headers);
+        }
+        m_body = getBool(SEND_BODY_PROP_NAME, SEND_BODY_PROP_DEFAULT);
     }
 
+    m_limitRedirects = getBool(LIMIT_REDIRECTS_PROP_NAME, LIMIT_REDIRECTS_PROP_DEFAULT);
+
     const char* settings = getString(REQUEST_MAPPER_SETTINGS_PROP_NAME);
     if (settings) {
         split_to_container(m_requestMapperSettings, settings);
@@ -92,9 +101,6 @@ Passthrough::Passthrough(const ptree& pt, const char* path)
     if (settings) {
         split_to_container(m_querySettings, settings);
     }
-
-    m_body = getBool(SEND_BODY_PROP_NAME, SEND_BODY_PROP_DEFAULT);
-    m_limitRedirects = getBool(LIMIT_REDIRECTS_PROP_NAME, LIMIT_REDIRECTS_PROP_DEFAULT);
 }
 
 pair<bool,long> Passthrough::run(SPRequest& request, bool isHandler) const
@@ -103,8 +109,10 @@ pair<bool,long> Passthrough::run(SPRequest& request, bool isHandler) const
         DDF input = request.getAgent().getRemotingService()->build(m_operation.c_str(), request);
         DDFJanitor inputJanitor(input);
 
-        DDF wrapped = wrapRequest(request, m_remotedHeaders, m_body);
-        input.add(wrapped);
+        if (m_wrapRequest) {
+            DDF wrapped = wrapRequest(request, m_remotedHeaders, m_body);
+            input.add(wrapped);
+        }
 
         // Handler base can be derived from "this" URL.
         input.addmember("handler_base").string(request.getHandlerURL());

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


More information about the commits mailing list