summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/http/httpd.hpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-07-06 09:06:07 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-07-06 09:06:07 +0000
commit4b05b5d35a0757ba9815897c18fba1e563fdca2a (patch)
tree9d0e63102e65da0746f5370674387c5ebb34faad /sca-cpp/trunk/modules/http/httpd.hpp
parent0389017140b0af23e061fdd66d7467da75f95e83 (diff)
Add support for HTTPD mass dynamic virtual hosting. Components can now be deployed, resolved, wired and invoked within a virtual host.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@960847 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/http/httpd.hpp')
-rw-r--r--sca-cpp/trunk/modules/http/httpd.hpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/sca-cpp/trunk/modules/http/httpd.hpp b/sca-cpp/trunk/modules/http/httpd.hpp
index 93137be4e2..bd4f6e8ada 100644
--- a/sca-cpp/trunk/modules/http/httpd.hpp
+++ b/sca-cpp/trunk/modules/http/httpd.hpp
@@ -75,6 +75,31 @@ template<typename C> C& serverConf(const cmd_parms *cmd, const module* mod) {
/**
+ * Return the name of a server.
+ */
+const string serverName(const server_rec* s) {
+ ostringstream n;
+ n << (s->server_scheme != NULL? s->server_scheme : "http") << "://"
+ << (s->server_hostname != NULL? s->server_hostname : "localhost") << ":"
+ << (s->port != 0? s->port : 80)
+ << (s->path != NULL? string(s->path, s->pathlen) : "");
+ return str(n);
+}
+
+/**
+ * Determine the name of a server from an HTTP request.
+ */
+const string serverName(request_rec* r) {
+ ostringstream n;
+ const char* hn = ap_get_server_name(r);
+ n << (r->server->server_scheme != NULL? r->server->server_scheme : "http") << "://"
+ << (hn != NULL? hn : (r->server->server_hostname != NULL? r->server->server_hostname : "localhost")) << ":"
+ << (r->server->port != 0? r->server->port : 80)
+ << (r->server->path != NULL? string(r->server->path, r->server->pathlen) : "");
+ return str(n);
+}
+
+/**
* Return the content type of a request.
*/
const char* optional(const char* s) {
@@ -295,7 +320,7 @@ const bool redirectFilters(ap_filter_t* f, request_rec* from, request_rec* to) {
}
/**
- * Create an HTTPD redirect request.
+ * Create an HTTPD internal redirect request.
* Similar to httpd/modules/http/http_request.c::internal_internal_redirect.
*/
extern "C" {
@@ -388,7 +413,7 @@ const int internalRedirect(request_rec* nr) {
}
/**
- * Create and process an HTTPD redirect request.
+ * Create and process an HTTPD internal redirect request.
*/
const int internalRedirect(const string& uri, request_rec* r) {
const failable<request_rec*, int> nr = httpd::internalRedirectRequest(uri, r);