Add default port method to request API
[shibboleth/cpp-xmltooling.git] / xmltooling / io / HTTPRequest.cpp
index a068a58..b038830 100644 (file)
@@ -51,6 +51,11 @@ GenericRequest::~GenericRequest()
 {
 }
 
+bool GenericRequest::isDefaultPort() const
+{
+    return false;
+}
+
 void GenericRequest::setLangDefaults(bool langFromClient, const XMLCh* defaultRange)
 {
     m_langFromClient = langFromClient;
@@ -184,6 +189,14 @@ bool HTTPRequest::isSecure() const
     return strcmp(getScheme(),"https")==0;
 }
 
+bool HTTPRequest::isDefaultPort() const
+{
+    if (isSecure())
+        return getPort() == 443;
+    else
+        return getPort() == 80;
+}
+
 string HTTPRequest::getLanguageRange() const
 {
     return getHeader("Accept-Language");