[cpp-xmltooling COMMIT] in /branches/REL_1/xmltooling/io: GenericRequest.h HTTPRequest.cpp HTTPRequest.h
noreply at shibboleth.net
noreply at shibboleth.net
Thu Feb 2 04:46:00 GMT 2012
Author: scantor
Date: Thu Feb 2 04:46:00 2012
New Revision: 959
URL: http://svn.shibboleth.net/view/cpp-xmltooling?rev=959&view=rev
Log:
Factor absolutize method back into xmltooling
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=959&r1=958&r2=959&view=diff
==============================================================================
--- branches/REL_1/xmltooling/io/GenericRequest.h (original)
+++ branches/REL_1/xmltooling/io/GenericRequest.h Thu Feb 2 04:46:00 2012
@@ -172,6 +172,13 @@
getClientCertificates() const=0;
/**
+ * Converts a relative URL into an absolute one based on the properties of the request.
+ *
+ * @param url input URL to convert, will be modified in place
+ */
+ virtual void absolutize(std::string& url) const;
+
+ /**
* Returns a language range to use in selecting language-specific
* content for this request.
* <p>The syntax is that of the HTTP 1.1 Accept-Language header, even
Modified: branches/REL_1/xmltooling/io/HTTPRequest.cpp
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/xmltooling/io/HTTPRequest.cpp?rev=959&r1=958&r2=959&view=diff
==============================================================================
--- branches/REL_1/xmltooling/io/HTTPRequest.cpp (original)
+++ branches/REL_1/xmltooling/io/HTTPRequest.cpp Thu Feb 2 04:46:00 2012
@@ -56,6 +56,20 @@
return false;
}
+void GenericRequest::absolutize(string& url) const
+{
+ if (url.empty())
+ url = '/';
+ if (url[0] == '/') {
+ // Compute a URL to the root of the site.
+ const char* scheme = getScheme();
+ string root = string(scheme) + "://" + getHostname();
+ if (!isDefaultPort())
+ root += ":" + lexical_cast<string>(getPort());
+ url = root + url;
+ }
+}
+
void GenericRequest::setLangDefaults(bool langFromClient, const XMLCh* defaultRange)
{
m_langFromClient = langFromClient;
Modified: branches/REL_1/xmltooling/io/HTTPRequest.h
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/xmltooling/io/HTTPRequest.h?rev=959&r1=958&r2=959&view=diff
==============================================================================
--- branches/REL_1/xmltooling/io/HTTPRequest.h (original)
+++ branches/REL_1/xmltooling/io/HTTPRequest.h Thu Feb 2 04:46:00 2012
@@ -28,9 +28,6 @@
#define __xmltooling_httpreq_h__
#include <xmltooling/io/GenericRequest.h>
-
-#include <map>
-#include <string>
namespace xmltooling {
More information about the commits
mailing list