diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-07-06 09:06:07 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-07-06 09:06:07 +0000 |
commit | 4b05b5d35a0757ba9815897c18fba1e563fdca2a (patch) | |
tree | 9d0e63102e65da0746f5370674387c5ebb34faad /sca-cpp/trunk/modules/http | |
parent | 0389017140b0af23e061fdd66d7467da75f95e83 (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')
-rwxr-xr-x | sca-cpp/trunk/modules/http/httpd-conf | 18 | ||||
-rwxr-xr-x | sca-cpp/trunk/modules/http/httpd-ssl-conf | 4 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/http/httpd.hpp | 29 |
3 files changed, 45 insertions, 6 deletions
diff --git a/sca-cpp/trunk/modules/http/httpd-conf b/sca-cpp/trunk/modules/http/httpd-conf index 2ef922145f..a6ba048f67 100755 --- a/sca-cpp/trunk/modules/http/httpd-conf +++ b/sca-cpp/trunk/modules/http/httpd-conf @@ -30,6 +30,13 @@ htdocs=`readlink -f $4` user=`id -un` group=`id -gn` modules_prefix=`cat $here/httpd-modules.prefix` +if [ "$5" = "vhost" ]; then + vhost="VirtualDocumentRoot $htdocs/domains/%1/" + maxr="MaxRequestsPerChild 1" +else + vhost="#VirtualDocumentRoot $htdocs/domains/%1/" + maxr="#MaxRequestsPerChild 1" +fi mkdir -p $root mkdir -p $root/logs @@ -39,8 +46,6 @@ cat >$root/conf/httpd.conf <<EOF # Set server name ServerName http://$host:$pport -UseCanonicalName On -UseCanonicalPhysicalPort off PidFile $root/logs/httpd.pid # Minimal set of modules @@ -68,6 +73,7 @@ LoadModule setenvif_module ${modules_prefix}/modules/mod_setenvif.so <IfModule !log_config_module> LoadModule log_config_module ${modules_prefix}/modules/mod_log_config.so </IfModule> +LoadModule vhost_alias_module ${modules_prefix}/modules/mod_vhost_alias.so # Basic security precautions User $user @@ -121,7 +127,15 @@ Allow from all Listen $port <VirtualHost _default_:$port> ServerName http://$host:$pport +UseCanonicalName Off +UseCanonicalPhysicalPort Off + +# Setup mass dynamic virtual hosting +$vhost </VirtualHost> +# Isolate dynamic virtual hosts +$maxr + EOF diff --git a/sca-cpp/trunk/modules/http/httpd-ssl-conf b/sca-cpp/trunk/modules/http/httpd-ssl-conf index df1d8042bc..04ca61dba0 100755 --- a/sca-cpp/trunk/modules/http/httpd-ssl-conf +++ b/sca-cpp/trunk/modules/http/httpd-ssl-conf @@ -55,8 +55,8 @@ SSLRandomSeed connect builtin Listen $sslport <VirtualHost _default_:$sslport> ServerName https://$host:$sslpport -UseCanonicalName On -UseCanonicalPhysicalPort off +UseCanonicalName Off +UseCanonicalPhysicalPort Off # Enable SSL SSLEngine on 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); |