diff options
Diffstat (limited to 'sca-cpp/trunk/modules/http')
-rw-r--r-- | sca-cpp/trunk/modules/http/curl.hpp | 8 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/http/httpd.hpp | 38 |
2 files changed, 11 insertions, 35 deletions
diff --git a/sca-cpp/trunk/modules/http/curl.hpp b/sca-cpp/trunk/modules/http/curl.hpp index 4e96411ec6..f2c9458f42 100644 --- a/sca-cpp/trunk/modules/http/curl.hpp +++ b/sca-cpp/trunk/modules/http/curl.hpp @@ -252,7 +252,7 @@ const failable<value> entryId(const failable<string> l) { if (!hasContent(l)) return mkfailure<value>(reason(l)); const string ls(content(l)); - return value(string(substr(ls, find_last(ls, '/') + 1))); + return value(mklist<value>(string(substr(ls, find_last(ls, '/') + 1)))); } /** @@ -381,18 +381,18 @@ const failable<value, string> del(const string& url, const CURLSession& ch) { * HTTP client proxy function. */ struct proxy { - proxy(const string& url) : url(url) { + proxy(const string& uri) : uri(uri) { } const value operator()(const list<value>& args) const { CURLSession cs; - failable<value> val = evalExpr(args, url, cs); + failable<value> val = evalExpr(args, uri, cs); if (!hasContent(val)) return value(); return content(val); } - const string url; + const string uri; }; } diff --git a/sca-cpp/trunk/modules/http/httpd.hpp b/sca-cpp/trunk/modules/http/httpd.hpp index 6b08c3b838..bd0e23f76b 100644 --- a/sca-cpp/trunk/modules/http/httpd.hpp +++ b/sca-cpp/trunk/modules/http/httpd.hpp @@ -75,30 +75,6 @@ template<typename C> C& serverConf(const cmd_parms *cmd, const module* mod) { /** - * Convert a path string to a list of values. - */ -const list<string> pathTokens(const char* p) { - if (p == NULL || p[0] == '\0') - return list<string>(); - if (p[0] == '/') - return tokenize("/", p + 1); - return tokenize("/", p); -} - -const list<value> pathValues(const char* p) { - return mkvalues(pathTokens(p)); -} - -/** - * Convert a path represented as a list of values to a string. - */ -const string path(const list<value>& p) { - if (isNil(p)) - return ""; - return string("/") + car(p) + path(cdr(p)); -} - -/** * Return the content type of a request. */ const char* optional(const char* s) { @@ -219,10 +195,10 @@ const list<string> read(request_rec* r) { } /** - * Convert a URI value to an absolute URL. + * Convert a URI represented as a list to an absolute URL. */ -const char* url(const value& v, request_rec* r) { - const string u = string(r->uri) + "/" + v; +const char* url(const list<value>& v, request_rec* r) { + const string u = string(r->uri) + path(v); return ap_construct_url(r->pool, c_str(u), r); } @@ -400,7 +376,7 @@ const int internalRedirect(const string& uri, request_rec* r) { /** * Put a value in the process user data. */ -const bool putUserData(const string& k, const int v, const server_rec* s) { +const bool putUserData(const string& k, const void* v, const server_rec* s) { apr_pool_userdata_set((const void *)v, c_str(k), apr_pool_cleanup_null, s->process->pool); return true; } @@ -408,10 +384,10 @@ const bool putUserData(const string& k, const int v, const server_rec* s) { /** * Return a user data value. */ -const int userData(const string& k, const server_rec* s) { - void* v = (int)0; +const void* userData(const string& k, const server_rec* s) { + void* v = NULL; apr_pool_userdata_get(&v, c_str(k), s->process->pool); - return (int)v; + return v; } } |