From 211c686bc6d05d8d05e5490b9a9f612619461abc Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Thu, 8 Jul 2010 06:38:07 +0000 Subject: 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 --- sca-cpp/trunk/modules/http/httpd.hpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'sca-cpp/trunk/modules/http/httpd.hpp') 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 @@ -99,6 +99,35 @@ const string serverName(request_rec* r) { return str(n); } +/** + * 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. */ -- cgit v1.2.3