summaryrefslogtreecommitdiff
path: root/src/HttpServerBodyCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-03-14 00:57:05 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-03-14 00:57:05 +0900
commitbf01bb84b6b96fe2cba529f588e29a9038c0daf6 (patch)
tree929c8ad8e4ec3eebdae8ffd046f7990b9f6dccae /src/HttpServerBodyCommand.cc
parentfeb4e2e53a368baa64dffd5e2182204548fe86d5 (diff)
Added JSONP support. Callback query parameter is "jsoncallback".
Diffstat (limited to 'src/HttpServerBodyCommand.cc')
-rw-r--r--src/HttpServerBodyCommand.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/HttpServerBodyCommand.cc b/src/HttpServerBodyCommand.cc
index c60502b1..7577d3eb 100644
--- a/src/HttpServerBodyCommand.cc
+++ b/src/HttpServerBodyCommand.cc
@@ -213,12 +213,16 @@ bool HttpServerBodyCommand::execute()
addHttpServerResponseCommand();
return true;
} else if(reqPath == "/jsonrpc") {
- // TODO handle query parameter
std::string callback;
-
SharedHandle<ValueBase> json;
try {
- json = json::decode(httpServer_->getBody());
+ if(httpServer_->getMethod() == "GET") {
+ json::JsonGetParam param = json::decodeGetParams(query);
+ callback = param.callback;
+ json = json::decode(param.request);
+ } else {
+ json = json::decode(httpServer_->getBody());
+ }
} catch(RecoverableException& e) {
A2_LOG_INFO_EX
(fmt("CUID#%lld - Failed to parse JSON-RPC request",