diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-08-14 18:46:26 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-08-14 18:46:26 +0000 |
commit | d6451b81703c809abcd0f51e74abdba7c732b513 (patch) | |
tree | fab2013702ae33a07e5bb43abad606e0201b485b /sca-cpp/trunk/modules/server | |
parent | d090bd129574458379aa9997345e7ca5b2c24886 (diff) |
Some refactoring of the HTTP support, tunnel Memcached requests over HTTPS and add HTTPS config to store-cluster sample.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@985561 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/server')
-rw-r--r-- | sca-cpp/trunk/modules/server/client-test.hpp | 2 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/server/mod-eval.hpp | 9 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/server/mod-wiring.cpp | 17 | ||||
-rwxr-xr-x | sca-cpp/trunk/modules/server/server-conf | 22 |
4 files changed, 22 insertions, 28 deletions
diff --git a/sca-cpp/trunk/modules/server/client-test.hpp b/sca-cpp/trunk/modules/server/client-test.hpp index 9b37a73803..f2fdb60877 100644 --- a/sca-cpp/trunk/modules/server/client-test.hpp +++ b/sca-cpp/trunk/modules/server/client-test.hpp @@ -31,7 +31,7 @@ #include "string.hpp" #include "parallel.hpp" #include "perf.hpp" -#include "../http/curl.hpp" +#include "../http/http.hpp" namespace tuscany { namespace server { diff --git a/sca-cpp/trunk/modules/server/mod-eval.hpp b/sca-cpp/trunk/modules/server/mod-eval.hpp index 0aff56f59d..0d90cb7ceb 100644 --- a/sca-cpp/trunk/modules/server/mod-eval.hpp +++ b/sca-cpp/trunk/modules/server/mod-eval.hpp @@ -37,7 +37,7 @@ #include "../atom/atom.hpp" #include "../json/json.hpp" #include "../scdl/scdl.hpp" -#include "../http/curl.hpp" +#include "../http/http.hpp" #include "../http/httpd.hpp" extern "C" { @@ -113,7 +113,7 @@ const failable<int> get(request_rec* r, const lambda<value(const list<value>&)>& const value func = c_str(json::funcName(string(cadr(ma)))); // Apply the requested function - const failable<value> val = failableResult(impl(cons(func, httpd::queryParams(args)))); + const failable<value> val = failableResult(impl(cons(func, json::queryParams(args)))); if (!hasContent(val)) return mkfailure<int>(reason(val)); @@ -250,6 +250,8 @@ const failable<int> del(request_rec* r, const lambda<value(const list<value>&)>& * Translate a component request. */ int translate(request_rec *r) { + if(r->method_number != M_GET && r->method_number != M_POST && r->method_number != M_PUT && r->method_number != M_DELETE) + return DECLINED; if (strncmp(r->uri, "/components/", 12) != 0) return DECLINED; r->handler = "mod_tuscany_eval"; @@ -544,8 +546,11 @@ const failable<bool> virtualHostCleanup(const ServerConf& sc) { * HTTP request handler. */ int handler(request_rec *r) { + if(r->method_number != M_GET && r->method_number != M_POST && r->method_number != M_PUT && r->method_number != M_DELETE) + return DECLINED; if(strcmp(r->handler, "mod_tuscany_eval")) return DECLINED; + gc_scoped_pool pool(r->pool); ScopedRequest sr(r); httpdDebugRequest(r, "modeval::handler::input"); diff --git a/sca-cpp/trunk/modules/server/mod-wiring.cpp b/sca-cpp/trunk/modules/server/mod-wiring.cpp index 964f7efc82..7ed47c7f48 100644 --- a/sca-cpp/trunk/modules/server/mod-wiring.cpp +++ b/sca-cpp/trunk/modules/server/mod-wiring.cpp @@ -299,13 +299,15 @@ const failable<bool> virtualHostConfig(ServerConf& sc, request_rec* r) { * to the target component. */ int translate(request_rec *r) { - gc_scoped_pool pool(r->pool); + if(r->method_number != M_GET && r->method_number != M_POST && r->method_number != M_PUT && r->method_number != M_DELETE) + return DECLINED; - // No translation needed for a component request + // No translation needed for a component or tunnel request if (!strncmp(r->uri, "/components/", 12)) return DECLINED; // Get the server configuration + gc_scoped_pool pool(r->pool); const ServerConf& sc = httpd::serverConf<ServerConf>(r, &mod_tuscany_wiring); // Process dynamic virtual host configuration, if any @@ -329,14 +331,17 @@ int translate(request_rec *r) { * HTTP request handler, redirect to a target component. */ int handler(request_rec *r) { - gc_scoped_pool pool(r->pool); + if(r->method_number != M_GET && r->method_number != M_POST && r->method_number != M_PUT && r->method_number != M_DELETE) + return DECLINED; if(strcmp(r->handler, "mod_tuscany_wiring")) return DECLINED; + if (r->filename == NULL || strncmp(r->filename, "/redirect:", 10) != 0) + return DECLINED; + + gc_scoped_pool pool(r->pool); httpdDebugRequest(r, "modwiring::handler::input"); // Do an internal redirect - if (r->filename == NULL || strncmp(r->filename, "/redirect:", 10) != 0) - return DECLINED; debug(r->uri, "modwiring::handler::uri"); debug(r->filename, "modwiring::handler::filename"); debug(r->path_info, "modwiring::handler::path info"); @@ -364,7 +369,7 @@ const int postConfigMerge(const ServerConf& mainsc, server_rec* s) { return postConfigMerge(mainsc, s->next); } -int postConfig(unused apr_pool_t *p, unused apr_pool_t *plog, unused apr_pool_t *ptemp, server_rec *s) { +int postConfig(apr_pool_t *p, unused apr_pool_t *plog, unused apr_pool_t *ptemp, server_rec *s) { gc_scoped_pool pool(p); // Count the calls to post config, skip the first one as diff --git a/sca-cpp/trunk/modules/server/server-conf b/sca-cpp/trunk/modules/server/server-conf index 4a318c6fce..7c72233ca9 100755 --- a/sca-cpp/trunk/modules/server/server-conf +++ b/sca-cpp/trunk/modules/server/server-conf @@ -57,27 +57,11 @@ ssl=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-ssl-conf"` if [ "$ssl" != "" ]; then cat >>$root/conf/httpd.conf <<EOF # Configure SSL certificates -SCAWiringSSLCACertificateFile "$root/conf/ca.crt" -SCAWiringSSLCertificateFile "$root/conf/server.crt" -SCAWiringSSLCertificateKeyFile "$root/conf/server.key" +SCAWiringSSLCACertificateFile "$root/cert/ca.crt" +SCAWiringSSLCertificateFile "$root/cert/server.crt" +SCAWiringSSLCertificateKeyFile "$root/cert/server.key" EOF fi -vhost=`cat $root/conf/httpd.conf | grep VirtualDocumentRoot` -proxy=`cat $root/conf/httpd.conf | grep ProxyPass` - -vhost=`cat $root/conf/httpd.conf | grep "# Generated by: vhost-conf"` -if [ "$vhost" != "" ]; then - proxy=`cat $root/conf/httpd.conf | grep "# Generated by: proxy-conf"` - if [ "$proxy" = "" ]; then - cat >>$root/conf/httpd.conf <<EOF -# Isolate requests from different virtual hosts -MaxRequestsPerChild 1 - -EOF - - fi -fi - |