From b262eb5031889cce999983edb18d46159c6a387c Mon Sep 17 00:00:00 2001 From: Nadav Har'El Date: Thu, 26 Dec 2019 16:17:38 +0200 Subject: [PATCH] alternator: use simpler API for registering Alternator's HTTP URLs We used the Seastar HTTP server's add() method to register URLs to serve (so-called "routes"), but as suggested by Amnon, when we have fixed URLs without parameters being path components, it's simpler to use the put() method to do the same thing - and also results in slightly less work at run-time to look up these routes. Signed-off-by: Nadav Har'El --- alternator/server.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/alternator/server.cc b/alternator/server.cc index 1a79043634..7af83cbff4 100644 --- a/alternator/server.cc +++ b/alternator/server.cc @@ -281,8 +281,8 @@ void server::set_routes(routes& r) { return handle_api_request(std::move(req)); }); - r.add(operation_type::POST, url("/"), req_handler); - r.add(operation_type::GET, url("/"), new health_handler); + r.put(operation_type::POST, "/", req_handler); + r.put(operation_type::GET, "/", new health_handler); // The "/localnodes" request is a new Alternator feature, not supported by // DynamoDB and not required for DynamoDB compatibility. It allows a // client to enquire - using a trivial HTTP request without requiring @@ -294,7 +294,7 @@ void server::set_routes(routes& r) { // consider this to be a security risk, because an attacker can already // scan an entire subnet for nodes responding to the health request, // or even just scan for open ports. - r.add(operation_type::GET, url("/localnodes"), new local_nodelist_handler); + r.put(operation_type::GET, "/localnodes", new local_nodelist_handler); } //FIXME: A way to immediately invalidate the cache should be considered,