summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/http/httpd.hpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-07-08 06:38:07 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-07-08 06:38:07 +0000
commit211c686bc6d05d8d05e5490b9a9f612619461abc (patch)
treebb8f56afb24f2b52ea92598babff7d94fd70da10 /sca-cpp/trunk/modules/http/httpd.hpp
parentf6a51224cc350c7d3b42b15051a9c074cce48b5d (diff)
More changes to get both single and mass dynamic virtual hosting working with HTTP and HTTPS.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@961589 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-cpp/trunk/modules/http/httpd.hpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/sca-cpp/trunk/modules/http/httpd.hpp b/sca-cpp/trunk/modules/http/httpd.hpp
index bd4f6e8ada..05403a5897 100644
--- a/sca-cpp/trunk/modules/http/httpd.hpp
+++ b/sca-cpp/trunk/modules/http/httpd.hpp
@@ -100,6 +100,35 @@ const string serverName(request_rec* r) {
}
/**
+ * Return the host name for a server.
+ */
+const string hostName(const server_rec* s) {
+ return s->server_hostname != NULL? s->server_hostname : "localhost";
+}
+
+/**
+ * Return the host name from an HTTP request.
+ */
+const string hostName(request_rec* r) {
+ const char* hn = ap_get_server_name(r);
+ return hn != NULL? hn : (r->server->server_hostname != NULL? r->server->server_hostname : "localhost");
+}
+
+/**
+ * Return the first subdomain name in a host name.
+ */
+const string subdomain(const string& host) {
+ return substr(host, 0, find(host, '.'));
+}
+
+/**
+ * Return true if a request is targeting a virtual host.
+ */
+const bool isVirtualHostRequest(const server_rec* s, request_rec* r) {
+ return serverName(r) != serverName(s);
+}
+
+/**
* Return the content type of a request.
*/
const char* optional(const char* s) {