From cc13358b7341ea468efe16b70503ce09d6570f79 Mon Sep 17 00:00:00 2001 From: digital dreamer Date: Fri, 30 May 2014 12:41:16 +0200 Subject: [PATCH] rss authentication --- src/bitcoinrpc.cpp | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 7f16826a..ef57a6e6 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -980,29 +980,7 @@ void ServiceConnection(AcceptedConnection *conn) if(strMethod == "GET" && strURI == "/") strURI="/home.html"; - if(strMethod == "GET" && strURI.substr(0, 4) == "/rss" && !GetBoolArg("-public_server_mode",false)) - { - string rssOutput; - int rssResult = generateRSS(strURI, &rssOutput); - - switch(rssResult) - { - case RSS_OK: - conn->stream() << HTTPReply(HTTP_OK, rssOutput, false, "application/rss+xml") << std::flush; - continue; - case RSS_ERROR_NO_ACCOUNT: - conn->stream() << HTTPReply(HTTP_BAD_REQUEST, "No accounts found - please register a username", false) << std::flush; - continue; - case RSS_ERROR_BAD_ACCOUNT: - conn->stream() << HTTPReply(HTTP_BAD_REQUEST, "Requested account is not registered on this node", false) << std::flush; - continue; - case RSS_ERROR_NOT_A_NUMBER: - conn->stream() << HTTPReply(HTTP_BAD_REQUEST, "Parameter 'max' must be a number", false) << std::flush; - continue; - } - } - - if (strURI != "/" && strURI.find("..") == std::string::npos ) { + if (strURI != "/" && strURI.substr(0, 4) != "/rss" && strURI.find("..") == std::string::npos ) { filesystem::path pathFile = filesystem::path(GetHTMLDir()) / strURI; std::string fname = pathFile.string(); size_t qMarkIdx = fname.find('?'); @@ -1059,6 +1037,28 @@ void ServiceConnection(AcceptedConnection *conn) } if (mapHeaders["connection"] == "close") fRun = false; + + if(strMethod == "GET" && strURI.substr(0, 4) == "/rss" && !GetBoolArg("-public_server_mode",false)) + { + string rssOutput; + int rssResult = generateRSS(strURI, &rssOutput); + + switch(rssResult) + { + case RSS_OK: + conn->stream() << HTTPReply(HTTP_OK, rssOutput, false, "application/rss+xml") << std::flush; + continue; + case RSS_ERROR_NO_ACCOUNT: + conn->stream() << HTTPReply(HTTP_BAD_REQUEST, "No accounts found - please register a username", false) << std::flush; + continue; + case RSS_ERROR_BAD_ACCOUNT: + conn->stream() << HTTPReply(HTTP_BAD_REQUEST, "Requested account is not registered on this node", false) << std::flush; + continue; + case RSS_ERROR_NOT_A_NUMBER: + conn->stream() << HTTPReply(HTTP_BAD_REQUEST, "Parameter 'max' must be a number", false) << std::flush; + continue; + } + } JSONRequest jreq; try