summaryrefslogtreecommitdiffstats
path: root/sca-cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sca-cpp/trunk/modules/atom/atom.hpp9
-rw-r--r--sca-cpp/trunk/modules/http/http.hpp4
-rw-r--r--sca-cpp/trunk/modules/server/mod-eval.hpp4
-rw-r--r--sca-cpp/trunk/modules/wsgi/atomutil.py6
-rwxr-xr-xsca-cpp/trunk/modules/wsgi/composite.py4
-rw-r--r--sca-cpp/trunk/modules/wsgi/httputil.py4
6 files changed, 23 insertions, 8 deletions
diff --git a/sca-cpp/trunk/modules/atom/atom.hpp b/sca-cpp/trunk/modules/atom/atom.hpp
index 253be9bdd6..ff172170f7 100644
--- a/sca-cpp/trunk/modules/atom/atom.hpp
+++ b/sca-cpp/trunk/modules/atom/atom.hpp
@@ -66,6 +66,15 @@ const bool isATOMFeed(const list<string>& ls) {
}
/**
+ * Return true if a list of strings contains an ATOM entry.
+ */
+const bool isATOMEntry(const list<string>& ls) {
+ if (!isXML(ls))
+ return false;
+ return contains(car(ls), "<entry") && !contains(car(ls), "<feed") && contains(car(ls), "=\"http://www.w3.org/2005/Atom\"");
+}
+
+/**
* Convert a list of strings to a list of values representing an ATOM entry.
*/
const failable<list<value> > readATOMEntry(const list<string>& ilist) {
diff --git a/sca-cpp/trunk/modules/http/http.hpp b/sca-cpp/trunk/modules/http/http.hpp
index 95b904435d..26a2e0cf0c 100644
--- a/sca-cpp/trunk/modules/http/http.hpp
+++ b/sca-cpp/trunk/modules/http/http.hpp
@@ -405,13 +405,13 @@ const failable<value> get(const string& url, const CURLSession& cs) {
const list<string> ls(reverse(cadr(content(res))));
debug(ls, "http::get::content");
- if (contains(ct, "application/atom+xml;type=entry")) {
+ if (atom::isATOMEntry(ls)) {
// Read an ATOM entry
const value val(atom::entryValue(content(atom::readATOMEntry(ls))));
debug(val, "http::get::result");
return val;
}
- if (contains(ct, "application/atom+xml;type=feed") || atom::isATOMFeed(ls)) {
+ if (contains(ct, "application/atom+xml") || atom::isATOMFeed(ls)) {
// Read an ATOM feed
const value val(atom::feedValues(content(atom::readATOMFeed(ls))));
debug(val, "http::get::result");
diff --git a/sca-cpp/trunk/modules/server/mod-eval.hpp b/sca-cpp/trunk/modules/server/mod-eval.hpp
index b8d3147459..8dac21de04 100644
--- a/sca-cpp/trunk/modules/server/mod-eval.hpp
+++ b/sca-cpp/trunk/modules/server/mod-eval.hpp
@@ -137,9 +137,9 @@ const failable<int> get(request_rec* r, const lambda<value(const list<value>&)>&
// Write ATOM feed or entry
if (isString(car<value>(c)) && isString(cadr<value>(c))) {
if (isNil(cddr(path)))
- return httpd::writeResult(atom::writeATOMFeed(atom::feedValuesToElements(c)), "application/atom+xml;type=feed", r);
+ return httpd::writeResult(atom::writeATOMFeed(atom::feedValuesToElements(c)), "application/atom+xml", r);
else
- return httpd::writeResult(atom::writeATOMEntry(atom::entryValuesToElements(c)), "application/atom+xml;type=entry", r);
+ return httpd::writeResult(atom::writeATOMEntry(atom::entryValuesToElements(c)), "application/atom+xml", r);
}
// Write JSON value
diff --git a/sca-cpp/trunk/modules/wsgi/atomutil.py b/sca-cpp/trunk/modules/wsgi/atomutil.py
index 106e69c3c6..8e812abbe9 100644
--- a/sca-cpp/trunk/modules/wsgi/atomutil.py
+++ b/sca-cpp/trunk/modules/wsgi/atomutil.py
@@ -54,6 +54,12 @@ def isATOMFeed(l):
return False
return contains(car(l), "<feed") and contains(car(l), "=\"http://www.w3.org/2005/Atom\"")
+# Return true if a list of strings represents an ATOM entry
+def isATOMEntry(l):
+ if not isXML(l):
+ return False
+ return contains(car(l), "<entry") and not contains(car(l), "<feed") and contains(car(l), "=\"http://www.w3.org/2005/Atom\"")
+
# Convert a list of strings to a list of values representing an ATOM feed
def readATOMFeed(l):
f = readXML(l)
diff --git a/sca-cpp/trunk/modules/wsgi/composite.py b/sca-cpp/trunk/modules/wsgi/composite.py
index ffd971fef5..9dbc2c911a 100755
--- a/sca-cpp/trunk/modules/wsgi/composite.py
+++ b/sca-cpp/trunk/modules/wsgi/composite.py
@@ -184,8 +184,8 @@ def application(e, r):
# Write an ATOM feed or entry
if isString(car(v)) and isString(cadr(v)):
if isNil(id):
- return result(e, r, 200, (("Content-type", "application/atom+xml;type=feed"),), writeATOMFeed(feedValuesToElements(v)))
- return result(e, r, 200, (("Content-type", "application/atom+xml;type=entry"),), writeATOMEntry(entryValuesToElements(v)))
+ return result(e, r, 200, (("Content-type", "application/atom+xml"),), writeATOMFeed(feedValuesToElements(v)))
+ return result(e, r, 200, (("Content-type", "application/atom+xml"),), writeATOMEntry(entryValuesToElements(v)))
# Write a JSON value
return result(e, r, 200, (("Content-type", "application/json"),), writeJSON(valuesToElements(v)))
diff --git a/sca-cpp/trunk/modules/wsgi/httputil.py b/sca-cpp/trunk/modules/wsgi/httputil.py
index ea00f3f9fe..842460cc6a 100644
--- a/sca-cpp/trunk/modules/wsgi/httputil.py
+++ b/sca-cpp/trunk/modules/wsgi/httputil.py
@@ -58,13 +58,13 @@ class client:
ct = res.getheader("Content-type", "text/plain")
ls = (res.read(),)
- if contains(ct, "application/atom+xml;type=entry"):
+ if atomutil.isATOMEntry(ls):
# Read an ATOM entry
v = atomutil.entryValue(atomutil.readATOMEntry(ls))
print >> stderr, "Client result", v
return v
- if contains(ct, "application/atom+xml;type=feed"):
+ if contains(ct, "application/atom+xml") or atomutil.isATOMFeed(ls):
# Read an ATOM feed
v = atomutil.feedValues(atomutil.readATOMFeed(ls))
print >> stderr, "Client result", v