diff options
Diffstat (limited to 'src/web/server/h2o')
-rw-r--r-- | src/web/server/h2o/http_server.c | 27 | ||||
-rw-r--r-- | src/web/server/h2o/rrdpush.c (renamed from src/web/server/h2o/streaming.c) | 2 | ||||
-rw-r--r-- | src/web/server/h2o/streaming.h | 2 |
3 files changed, 18 insertions, 13 deletions
diff --git a/src/web/server/h2o/http_server.c b/src/web/server/h2o/http_server.c index a079c6af..0fc65b35 100644 --- a/src/web/server/h2o/http_server.c +++ b/src/web/server/h2o/http_server.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later #include "daemon/common.h" -#include "streaming/common.h" +#include "streaming/h2o-common.h" #include "http_server.h" #pragma GCC diagnostic push @@ -24,6 +24,7 @@ static h2o_accept_ctx_t accept_ctx; #define NBUF_INITIAL_SIZE_RESP (4096) #define API_V1_PREFIX "/api/v1/" #define API_V2_PREFIX "/api/v2/" +#define API_V3_PREFIX "/api/v3/" #define HOST_SELECT_PREFIX "/host/" #define HTTPD_CONFIG_SECTION "httpd" @@ -182,13 +183,17 @@ static inline int _netdata_uberhandler(h2o_req_t *req, RRDHOST **host) norm_path.len--; } - unsigned int api_version = 2; - size_t api_loc = h2o_strstr(norm_path.base, norm_path.len, H2O_STRLIT(API_V2_PREFIX)); + unsigned int api_version = 3; + size_t api_loc = h2o_strstr(norm_path.base, norm_path.len, H2O_STRLIT(API_V3_PREFIX)); if (api_loc == SIZE_MAX) { - api_version = 1; - api_loc = h2o_strstr(norm_path.base, norm_path.len, H2O_STRLIT(API_V1_PREFIX)); - if (api_loc == SIZE_MAX) - return 1; + api_version = 2; + api_loc = h2o_strstr(norm_path.base, norm_path.len, H2O_STRLIT(API_V2_PREFIX)); + if (api_loc == SIZE_MAX) { + api_version = 1; + api_loc = h2o_strstr(norm_path.base, norm_path.len, H2O_STRLIT(API_V1_PREFIX)); + if (api_loc == SIZE_MAX) + return 1; + } } // API_V1_PREFIX and API_V2_PREFIX are the same length @@ -235,7 +240,9 @@ static inline int _netdata_uberhandler(h2o_req_t *req, RRDHOST **host) } //inline int web_client_api_request_v2(RRDHOST *host, struct web_client *w, char *url_path_endpoint) { - if (api_version == 2) + if (api_version == 3) + web_client_api_request_v3(*host, &w, path_unescaped); + else if (api_version == 2) web_client_api_request_v2(*host, &w, path_unescaped); else web_client_api_request_v1(*host, &w, path_unescaped); @@ -283,7 +290,7 @@ static int netdata_uberhandler(h2o_handler_t *self, h2o_req_t *req) char host_uuid_str[UUID_STR_LEN]; if (host != NULL) - uuid_unparse_lower(host->host_uuid, host_uuid_str); + uuid_unparse_lower(host->host_id.uuid, host_uuid_str); nd_log(NDLS_ACCESS, NDLP_DEBUG, "HTTPD OK method: " PRINTF_H2O_IOVEC_FMT ", path: " PRINTF_H2O_IOVEC_FMT @@ -314,7 +321,7 @@ static int hdl_netdata_conf(h2o_handler_t *self, h2o_req_t *req) return -1; BUFFER *buf = buffer_create(NBUF_INITIAL_SIZE_RESP, NULL); - config_generate(buf, 0); + netdata_conf_generate(buf, 0); void *managed = h2o_mem_alloc_shared(&req->pool, buf->len, NULL); memcpy(managed, buf->buffer, buf->len); diff --git a/src/web/server/h2o/streaming.c b/src/web/server/h2o/rrdpush.c index fbe3f805..515ec8fd 100644 --- a/src/web/server/h2o/streaming.c +++ b/src/web/server/h2o/rrdpush.c @@ -4,7 +4,7 @@ #include "streaming.h" #include "connlist.h" #include "h2o_utils.h" -#include "streaming/common.h" +#include "streaming/h2o-common.h" static int pending_write_reqs = 0; diff --git a/src/web/server/h2o/streaming.h b/src/web/server/h2o/streaming.h index dfc7b68f..a30f4a8e 100644 --- a/src/web/server/h2o/streaming.h +++ b/src/web/server/h2o/streaming.h @@ -3,8 +3,6 @@ #ifndef HTTPD_STREAMING_H #define HTTPD_STREAMING_H -#include "aclk/mqtt_websockets/c-rbuf/cringbuffer.h" - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-but-set-variable" |