mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-31 03:56:42 +00:00
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 <nyh@scylladb.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user