diff options
| author | Jeff Garzik <[email protected]> | 2013-05-01 10:41:24 -0400 |
|---|---|---|
| committer | Jeff Garzik <[email protected]> | 2013-05-01 10:41:24 -0400 |
| commit | 9f4976afe2568a6dd4a4026292e91697bedda4b6 (patch) | |
| tree | f3b946a577c65d95b02fe8c5e697cf7496efd6fd /src/bitcoinrpc.cpp | |
| parent | Merge pull request #2595 from sipa/noannloc (diff) | |
| download | discoin-9f4976afe2568a6dd4a4026292e91697bedda4b6.tar.xz discoin-9f4976afe2568a6dd4a4026292e91697bedda4b6.zip | |
RPC: strictly require HTTP URI "/"
Previously, JSON-RPC clients accessed URI "/", and the JSON-RPC server
did not care about the URI at all, and would accept any URI as valid.
Change the JSON-RPC server to require URI "/" for all current accesses.
This changes enables the addition of future interfaces at different
URIs, such as pull request #1982 which demonstrates HTTP REST wallet
download.
Or, a future, breaking change in JSON-RPC interface could be introduced
by serving JSON-RPC calls from new URI "/v2/".
Diffstat (limited to 'src/bitcoinrpc.cpp')
| -rw-r--r-- | src/bitcoinrpc.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 9c126fc3d..a9b73fd5a 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -940,6 +940,11 @@ void ServiceConnection(AcceptedConnection *conn) // Read HTTP message headers and body ReadHTTPMessage(conn->stream(), mapHeaders, strRequest, nProto); + if (strURI != "/") { + conn->stream() << HTTPReply(HTTP_NOT_FOUND, "", false) << std::flush; + break; + } + // Check authorization if (mapHeaders.count("authorization") == 0) { |