summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/http/httpd.hpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-03-13 18:40:38 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-03-13 18:40:38 +0000
commit7fc75cdf0b19e8f748505931164d1756e796b833 (patch)
tree1fb9c5801b1b4a85e1ce6bf992d343e9129d9d99 /sca-cpp/trunk/modules/http/httpd.hpp
parent1bc5e535cb8231e25da4cefa5a77417dc0310074 (diff)
Improved handling of HTTP etags and dynamic content expiration.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@922644 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/http/httpd.hpp')
-rw-r--r--sca-cpp/trunk/modules/http/httpd.hpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/sca-cpp/trunk/modules/http/httpd.hpp b/sca-cpp/trunk/modules/http/httpd.hpp
index bd0e23f76b..dfc3dcc47e 100644
--- a/sca-cpp/trunk/modules/http/httpd.hpp
+++ b/sca-cpp/trunk/modules/http/httpd.hpp
@@ -213,10 +213,18 @@ const failable<int> writeResult(const failable<list<string> >& ls, const string&
const string ob(str(os));
debug(ob, "httpd::result");
+ // 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");
+
+ // Compute and return an Etag for the returned content
const string etag(ap_md5(r->pool, (const unsigned char*)c_str(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
const char* match = apr_table_get(r->headers_in, "If-None-Match");
apr_table_setn(r->headers_out, "ETag", apr_pstrdup(r->pool, c_str(etag)));
if (match != NULL && etag == match) {
+
r->status = HTTP_NOT_MODIFIED;
return OK;
}