diff options
author | Jeff Garzik <jgarzik@bitpay.com> | 2014-11-11 04:52:43 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@bitpay.com> | 2014-11-11 04:52:43 -0500 |
commit | e2655e0ab1fc36cd4a58a5145c53500cb7b2d4d0 (patch) | |
tree | a4ebff17c00212fd883cd2089f2aef1a3cf8db0e /src/rpcserver.cpp | |
parent | 83f5daf2fe6e2f42c81576097f4084d2788b454b (diff) |
Add unauthenticated HTTP REST interface to public blockchain data.
Diffstat (limited to 'src/rpcserver.cpp')
-rw-r--r-- | src/rpcserver.cpp | 9 |
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; } } |