[cpp-sp COMMIT] in /branches/REL_2/shibsp: AbstractSPRequest.cpp handler/impl/AbstractHandler.cpp
noreply at shibboleth.net
noreply at shibboleth.net
Thu Feb 2 22:18:16 GMT 2012
Author: scantor
Date: Thu Feb 2 22:18:15 2012
New Revision: 3570
URL: http://svn.shibboleth.net/view/cpp-sp?rev=3570&view=rev
Log:
Clean up default port handling
Modified:
branches/REL_2/shibsp/AbstractSPRequest.cpp
branches/REL_2/shibsp/handler/impl/AbstractHandler.cpp
Modified: branches/REL_2/shibsp/AbstractSPRequest.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/AbstractSPRequest.cpp?rev=3570&r1=3569&r2=3570&view=diff
==============================================================================
--- branches/REL_2/shibsp/AbstractSPRequest.cpp (original)
+++ branches/REL_2/shibsp/AbstractSPRequest.cpp Thu Feb 2 22:18:15 2012
@@ -199,9 +199,8 @@
int port = getPort();
const char* scheme = getScheme();
m_url = string(scheme) + "://" + getHostname();
- if ((!strcmp(scheme,"http") && port != 80) || (!strcmp(scheme,"https") && port != 443)) {
+ if (!isDefaultPort())
m_url += ":" + boost::lexical_cast<string>(port);
- }
m_url += m_uri;
}
return m_url.c_str();
@@ -250,9 +249,8 @@
int port = getPort();
const char* scheme = getScheme();
stackresource = string(scheme) + "://" + getHostname();
- if ((!strcmp(scheme,"http") && port != 80) || (!strcmp(scheme,"https") && port != 443)) {
+ if (!isDefaultPort())
stackresource += ":" + boost::lexical_cast<string>(port);
- }
stackresource += resource;
resource = stackresource.c_str();
}
Modified: branches/REL_2/shibsp/handler/impl/AbstractHandler.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/handler/impl/AbstractHandler.cpp?rev=3570&r1=3569&r2=3570&view=diff
==============================================================================
--- branches/REL_2/shibsp/handler/impl/AbstractHandler.cpp (original)
+++ branches/REL_2/shibsp/handler/impl/AbstractHandler.cpp Thu Feb 2 22:18:15 2012
@@ -87,6 +87,7 @@
SHIBSP_DLLLOCAL PluginManager< Handler,string,pair<const DOMElement*,const char*> >::Factory StatusHandlerFactory;
SHIBSP_DLLLOCAL PluginManager< Handler,string,pair<const DOMElement*,const char*> >::Factory SessionHandlerFactory;
+
void SHIBSP_DLLLOCAL generateRandomHex(std::string& buf, unsigned int len) {
static char DIGITS[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
int r;
@@ -113,11 +114,8 @@
vector<string> whitelist;
if (!strcmp(relayStateLimit.second, "exact")) {
// Scheme and hostname have to match.
- if (!strcmp(httpRequest.getScheme(), "https") && httpRequest.getPort() == 443) {
- whitelist.push_back(string("https://") + httpRequest.getHostname() + '/');
- }
- else if (!strcmp(httpRequest.getScheme(), "http") && httpRequest.getPort() == 80) {
- whitelist.push_back(string("http://") + httpRequest.getHostname() + '/');
+ if (httpRequest.isDefaultPort()) {
+ whitelist.push_back(string(httpRequest.getScheme()) + httpRequest.getHostname() + '/');
}
whitelist.push_back(
string(httpRequest.getScheme()) + "://" + httpRequest.getHostname() + ':' + lexical_cast<string>(httpRequest.getPort()) + '/'
More information about the commits
mailing list