Add unauthenticated HTTP REST interface to public blockchain data.

This commit is contained in:
Jeff Garzik
2014-11-11 04:52:43 -05:00
parent 83f5daf2fe
commit e2655e0ab1
4 changed files with 216 additions and 1 deletions

View File

@@ -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;
}
}