aboutsummaryrefslogtreecommitdiff
path: root/src/rpcserver.cpp
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@bitpay.com>2014-11-11 04:52:43 -0500
committerJeff Garzik <jgarzik@bitpay.com>2014-11-11 04:52:43 -0500
commite2655e0ab1fc36cd4a58a5145c53500cb7b2d4d0 (patch)
treea4ebff17c00212fd883cd2089f2aef1a3cf8db0e /src/rpcserver.cpp
parent83f5daf2fe6e2f42c81576097f4084d2788b454b (diff)
Add unauthenticated HTTP REST interface to public blockchain data.
Diffstat (limited to 'src/rpcserver.cpp')
-rw-r--r--src/rpcserver.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp
index cc80887ba4..d072f18e36 100644
--- a/src/rpcserver.cpp
+++ b/src/rpcserver.cpp
@@ -946,11 +946,18 @@ void ServiceConnection(AcceptedConnection *conn)
if (mapHeaders["connection"] == "close")
fRun = false;
+ // Process via JSON-RPC API
if (strURI == "/") {
if (!HTTPReq_JSONRPC(conn, strRequest, mapHeaders, fRun))
break;
+
+ // Process via HTTP REST API
+ } else if (strURI.substr(0, 6) == "/rest/") {
+ if (!HTTPReq_REST(conn, strURI, mapHeaders, fRun))
+ break;
+
} else {
- conn->stream() << HTTPError(HTTP_NOT_FOUND, false) << std::flush;
+ conn->stream() << HTTPReply(HTTP_NOT_FOUND, "", false) << std::flush;
break;
}
}