diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-09-07 01:40:04 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-09-07 01:40:04 +0000 |
commit | 8a21fca095cf96601db69cb719e7f94b73bc7744 (patch) | |
tree | e26cc102b5e75d62a631b01fd1a52633137d0f0e /sca-cpp | |
parent | f75296a86350e41c01a355c945ca348082260cf9 (diff) |
Minor tweaks to make the OAuth support work with Github.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@993192 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp')
-rw-r--r-- | sca-cpp/trunk/modules/http/http.hpp | 2 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/http/httpd.hpp | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/sca-cpp/trunk/modules/http/http.hpp b/sca-cpp/trunk/modules/http/http.hpp index 1932ac3420..db860aeee2 100644 --- a/sca-cpp/trunk/modules/http/http.hpp +++ b/sca-cpp/trunk/modules/http/http.hpp @@ -419,7 +419,7 @@ const failable<value> get(const string& url, const CURLSession& cs) { debug(val, "http::get::result"); return val; } - if (contains(ct, "text/javascript") || contains(ct, "application/json-rpc")) { + if (contains(ct, "text/javascript") || contains(ct, "application/json")) { json::JSONContext cx; const value val(json::jsonValues(content(json::readJSON(ls, cx)))); debug(val, "http::get::result"); diff --git a/sca-cpp/trunk/modules/http/httpd.hpp b/sca-cpp/trunk/modules/http/httpd.hpp index f407e1012e..870aed71b7 100644 --- a/sca-cpp/trunk/modules/http/httpd.hpp +++ b/sca-cpp/trunk/modules/http/httpd.hpp @@ -204,7 +204,7 @@ const string url(const string& uri, request_rec* r) { /** * Escape a URI. */ -const char escape_c2x[] = "0123456789abcdef"; +const char escape_c2x[] = "0123456789ABCDEF"; const string escape(const string& uri) { debug(uri, "httpd::escape::uri"); char* copy = (char*)apr_palloc(gc_current_pool(), 3 * length(uri) + 3); @@ -248,8 +248,15 @@ const list<value> queryArg(const string& s) { return mklist<value>(c_str(car(t)), cadr(t)); } +const string fixupQueryArgs(const string& a) { + const list<string> t = tokenize("?", a); + if (isNil(t) || isNil(cdr(t))) + return a; + return join("&", t); +} + const list<list<value> > queryArgs(const string& a) { - return map<string, list<value>>(queryArg, tokenize("&", a)); + return map<string, list<value>>(queryArg, tokenize("&", fixupQueryArgs(a))); } /** |