[cpp-sp] branch master updated: SSPCPP-672 - Stop sorting endpoints in generated metadata by location

Scott Cantor cantor.2 at osu.edu
Thu Jun 2 23:42:07 EDT 2016


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

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

The following commit(s) were added to refs/heads/master by this push:
       new  fce3aa9   SSPCPP-672 - Stop sorting endpoints in generated metadata by location
fce3aa9 is described below

commit fce3aa939b6978db0dbf892a763b1c906e4833e6
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Jun 2 23:41:18 2016 -0400

    SSPCPP-672 - Stop sorting endpoints in generated metadata by location
    
    https://issues.shibboleth.net/jira/browse/SSPCPP-672
---
 shibsp/impl/XMLServiceProvider.cpp | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/shibsp/impl/XMLServiceProvider.cpp b/shibsp/impl/XMLServiceProvider.cpp
index 5a985a9..20f94f8 100644
--- a/shibsp/impl/XMLServiceProvider.cpp
+++ b/shibsp/impl/XMLServiceProvider.cpp
@@ -1760,11 +1760,19 @@ const Handler* XMLApplication::getHandler(const char* path) const
 void XMLApplication::getHandlers(vector<const Handler*>& handlers) const
 {
     static void (vector<const Handler*>::* pb)(const Handler* const&) = &vector<const Handler*>::push_back;
+    // Copy all of the override's handlers.
     for_each(m_handlers.begin(), m_handlers.end(), boost::bind(pb, boost::ref(handlers), boost::bind(&boost::shared_ptr<Handler>::get, _1)));
     if (m_base) {
-        for (map<string,const Handler*>::const_iterator h = m_base->m_handlerMap.begin(); h != m_base->m_handlerMap.end(); ++h) {
-            if (m_handlerMap.count(h->first) == 0)
-                handlers.push_back(h->second);
+        if (handlers.empty()) {
+            // If the override doesn't supply any handlers, copy the parent's in normal order.
+            for_each(m_base->m_handlers.begin(), m_base->m_handlers.end(), boost::bind(pb, boost::ref(handlers), boost::bind(&boost::shared_ptr<Handler>::get, _1)));
+        }
+        else {
+            // This unfortunately distorts the usual ordering when it comes to metadata generation, but avoiding that would be a lot of code.
+            for (map<string, const Handler*>::const_iterator h = m_base->m_handlerMap.begin(); h != m_base->m_handlerMap.end(); ++h) {
+                if (m_handlerMap.count(h->first) == 0)
+                    handlers.push_back(h->second);
+            }
         }
     }
 }

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


More information about the commits mailing list