[cpp-xmltooling COMMIT] in /branches/REL_1/xmltooling/io: GenericRequest.h HTTPRequest.cpp HTTPRequest.h
noreply at shibboleth.net
noreply at shibboleth.net
Wed Feb 1 20:45:59 GMT 2012
Author: scantor
Date: Wed Feb 1 20:45:59 2012
New Revision: 958
URL: http://svn.shibboleth.net/view/cpp-xmltooling?rev=958&view=rev
Log:
Add default port method to request API
Modified:
branches/REL_1/xmltooling/io/GenericRequest.h
branches/REL_1/xmltooling/io/HTTPRequest.cpp
branches/REL_1/xmltooling/io/HTTPRequest.h
Modified: branches/REL_1/xmltooling/io/GenericRequest.h
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/xmltooling/io/GenericRequest.h?rev=958&r1=957&r2=958&view=diff
==============================================================================
--- branches/REL_1/xmltooling/io/GenericRequest.h (original)
+++ branches/REL_1/xmltooling/io/GenericRequest.h Wed Feb 1 20:45:59 2012
@@ -85,6 +85,13 @@
virtual int getPort() const=0;
/**
+ * Returns true iff the request port is the default port for the request protocol.
+ *
+ * @return default port indicator
+ */
+ virtual bool isDefaultPort() const;
+
+ /**
* Returns the MIME type of the request, if known.
*
* @return the MIME type, or an empty string
Modified: branches/REL_1/xmltooling/io/HTTPRequest.cpp
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/xmltooling/io/HTTPRequest.cpp?rev=958&r1=957&r2=958&view=diff
==============================================================================
--- branches/REL_1/xmltooling/io/HTTPRequest.cpp (original)
+++ branches/REL_1/xmltooling/io/HTTPRequest.cpp Wed Feb 1 20:45:59 2012
@@ -51,6 +51,11 @@
{
}
+bool GenericRequest::isDefaultPort() const
+{
+ return false;
+}
+
void GenericRequest::setLangDefaults(bool langFromClient, const XMLCh* defaultRange)
{
m_langFromClient = langFromClient;
@@ -184,6 +189,14 @@
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");
Modified: branches/REL_1/xmltooling/io/HTTPRequest.h
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/xmltooling/io/HTTPRequest.h?rev=958&r1=957&r2=958&view=diff
==============================================================================
--- branches/REL_1/xmltooling/io/HTTPRequest.h (original)
+++ branches/REL_1/xmltooling/io/HTTPRequest.h Wed Feb 1 20:45:59 2012
@@ -55,6 +55,7 @@
virtual ~HTTPRequest();
bool isSecure() const;
+ bool isDefaultPort() const;
std::string getLanguageRange() const;
/**
More information about the commits
mailing list