From 04feb4448fab78dac67d7db16861f2697d7add8c Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Tue, 22 Nov 2016 10:02:23 +0800 Subject: [PATCH] robot's blockade removed --- main.cpp | 55 ++++++------------------------------------------------- 1 file changed, 6 insertions(+), 49 deletions(-) diff --git a/main.cpp b/main.cpp index 665bc08..5b9638f 100644 --- a/main.cpp +++ b/main.cpp @@ -117,18 +117,6 @@ int main(int ac, const char* av[]) { CROW_ROUTE(app, "/") ([&](const crow::request& req) { - - for (const auto& m : req.headers) - cout << m.first << ": " << m.second << endl; - - // there is some robot scanning everything - // on the explorer. I block it with this - if (!xmreg::does_header_has(req, "Accept", "q=.2, */*; q=.2").empty()) - { - cout << "Scanner with q=.2, */*; q=.2 blocked!" << endl; - return crow::response(400); - } - return crow::response(xmrblocks.index2()); }); @@ -139,47 +127,16 @@ int main(int ac, const char* av[]) { CROW_ROUTE(app, "/block/") ([&](const crow::request& req, size_t block_height) { - - // there is some robot scanning everything - // on the explorer. I block it with this - if (!xmreg::does_header_has(req, "Accept", "q=.2, */*; q=.2").empty()) - { - cout << "Scanner with q=.2, */*; q=.2 blocked!" << endl; - return crow::response(400); - } - return crow::response(xmrblocks.show_block(block_height)); }); CROW_ROUTE(app, "/block/") ([&](const crow::request& req, string block_hash) { - - // there is some robot scanning everything - // on the explorer. I block it with this - if (!xmreg::does_header_has(req, "Accept", "q=.2, */*; q=.2").empty()) - { - cout << "Scanner with q=.2, */*; q=.2 blocked!" << endl; - return crow::response(400); - } - return crow::response(xmrblocks.show_block(block_hash)); }); CROW_ROUTE(app, "/tx/") ([&](const crow::request& req, string tx_hash) { - - - for (const auto& m : req.headers) - cout << m.first << ": " << m.second << endl; - - // there is some robot scanning everything - // on the explorer. I block it with this - if (!xmreg::does_header_has(req, "Accept", "q=.2, */*; q=.2").empty()) - { - cout << "Scanner with q=.2, */*; q=.2 blocked!" << endl; - return crow::response(400); - } - return crow::response(xmrblocks.show_tx(tx_hash)); }); @@ -266,12 +223,12 @@ int main(int ac, const char* av[]) { return xmrblocks.search(string(req.url_params.get("value"))); }); - CROW_ROUTE(app, "/robots.txt") - ([&]() { - string text = "User-agent: *\n" - "Disallow: "; - return text; - }); +// CROW_ROUTE(app, "/robots.txt") +// ([&]() { +// string text = "User-agent: *\n" +// "Disallow: "; +// return text; +// }); CROW_ROUTE(app, "/autorefresh") ([&]() {