https://issues.shibboleth.net/jira/browse/SSPCPP-220
authorScott Cantor <cantor.2@osu.edu>
Mon, 10 Aug 2009 19:22:12 +0000 (19:22 +0000)
committerScott Cantor <cantor.2@osu.edu>
Mon, 10 Aug 2009 19:22:12 +0000 (19:22 +0000)
configs/shibboleth2.xml
shibsp/handler/impl/AbstractHandler.cpp

index 0cfc813..d02da4c 100644 (file)
@@ -82,7 +82,6 @@
     -->
     <ApplicationDefaults id="default" policyId="default"
         entityID="https://sp.example.org/shibboleth"
-        homeURL="https://sp.example.org/index.html"
         REMOTE_USER="eppn persistent-id targeted-id"
         signing="false" encryption="false">
 
index dea2ae3..e42ef5b 100644 (file)
@@ -414,7 +414,20 @@ void AbstractHandler::recoverRelayState(
     // Check for "default" value (or the old "cookie" value that might come from stale bookmarks).
     if (relayState.empty() || relayState == "default" || relayState == "cookie") {
         pair<bool,const char*> homeURL=application.getString("homeURL");
-        relayState=homeURL.first ? homeURL.second : "/";
+        if (homeURL.first)
+            relayState=homeURL.second;
+        else {
+            // Compute a URL to the root of the site.
+            int port = request.getPort();
+            const char* scheme = request.getScheme();
+            relayState = string(scheme) + "://" + request.getHostname();
+            if ((!strcmp(scheme,"http") && port!=80) || (!strcmp(scheme,"https") && port!=443)) {
+                ostringstream portstr;
+                portstr << port;
+                relayState += ":" + portstr.str();
+            }
+            relayState += '/';
+        }
     }
 }