summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/http/httpd.hpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-04-17 22:14:18 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-04-17 22:14:18 +0000
commita0f68830211cbea1112794922939f8c5e90d7c4e (patch)
tree79b0ac2bf128a18e80bb08c19f3d08efe6fc5ec6 /sca-cpp/trunk/modules/http/httpd.hpp
parentff2490e3b4638b421c381946d8b1ebb30e51141b (diff)
Fix representation of null values and escape control characters in JSON and HTTP query strings.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1094210 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/http/httpd.hpp')
-rw-r--r--sca-cpp/trunk/modules/http/httpd.hpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/sca-cpp/trunk/modules/http/httpd.hpp b/sca-cpp/trunk/modules/http/httpd.hpp
index 0dd7920f65..86a89d8823 100644
--- a/sca-cpp/trunk/modules/http/httpd.hpp
+++ b/sca-cpp/trunk/modules/http/httpd.hpp
@@ -252,6 +252,20 @@ const string unescape(const string& uri) {
}
/**
+ * Unescape a list of key of value pairs representing query args.
+ */
+const list<value> unescapeArg(const list<value> a) {
+ return mklist<value>(car(a), unescape(cadr(a)));
+}
+
+const list<list<value> > unescapeArgs(const list<list<value> > args) {
+ debug(args, "httpd::unescape::args");
+ const list<list<value> > uargs = map<list<value>, list<value>>(unescapeArg, args);
+ debug(uargs, "httpd::unescape::result");
+ return uargs;
+}
+
+/**
* Returns a list of key value pairs from the args in a query string.
*/
const list<value> queryArg(const string& s) {
@@ -328,11 +342,11 @@ const failable<int> writeResult(const failable<list<string> >& ls, const string&
const string ob(str(os));
// Make sure browsers come back and check for updated dynamic content
- apr_table_setn(r->headers_out, "Expires", "Tue, 01 Jan 1980 00:00:00 GMT");
- apr_table_setn(r->headers_out, "Cache-Control", "must-revalidate");
+ // The actual header setup is configured in httpd-conf, based on the must-revalidate env variable
+ apr_table_set(r->subprocess_env, apr_pstrdup(r->pool, "must-revalidate"), apr_pstrdup(r->pool, "true"));
// Compute and return an Etag for the returned content
- const string etag(ap_md5(r->pool, (const unsigned char*)c_str(ob)));
+ const string etag(ap_md5_binary(r->pool, (const unsigned char*)c_str(ob), (int)length(ob)));
// Check for an If-None-Match header and just return a 304 not-modified status
// if the Etag matches the Etag presented by the client, to save bandwith