summaryrefslogtreecommitdiffstats
path: root/src/web/server/h2o
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/web/server/h2o/connlist.c (renamed from web/server/h2o/connlist.c)1
-rw-r--r--src/web/server/h2o/connlist.h (renamed from web/server/h2o/connlist.h)0
-rw-r--r--src/web/server/h2o/h2o_utils.c (renamed from web/server/h2o/h2o_utils.c)2
-rw-r--r--src/web/server/h2o/h2o_utils.h (renamed from web/server/h2o/h2o_utils.h)0
-rw-r--r--src/web/server/h2o/http_server.c (renamed from web/server/h2o/http_server.c)27
-rw-r--r--src/web/server/h2o/http_server.h (renamed from web/server/h2o/http_server.h)2
-rw-r--r--src/web/server/h2o/streaming.c (renamed from web/server/h2o/streaming.c)8
-rw-r--r--src/web/server/h2o/streaming.h (renamed from web/server/h2o/streaming.h)9
8 files changed, 34 insertions, 15 deletions
diff --git a/web/server/h2o/connlist.c b/src/web/server/h2o/connlist.c
index 272e65cac..5df12b86b 100644
--- a/web/server/h2o/connlist.c
+++ b/src/web/server/h2o/connlist.c
@@ -1,3 +1,4 @@
+#include "libnetdata/libnetdata.h"
#include "connlist.h"
conn_list_t conn_list = { NULL, NULL, 0, 0, PTHREAD_MUTEX_INITIALIZER };
diff --git a/web/server/h2o/connlist.h b/src/web/server/h2o/connlist.h
index 8848b85be..8848b85be 100644
--- a/web/server/h2o/connlist.h
+++ b/src/web/server/h2o/connlist.h
diff --git a/web/server/h2o/h2o_utils.c b/src/web/server/h2o/h2o_utils.c
index 943216f59..3038b6156 100644
--- a/web/server/h2o/h2o_utils.c
+++ b/src/web/server/h2o/h2o_utils.c
@@ -25,7 +25,7 @@ h2o_iovec_pair_vector_t *parse_URL_params(h2o_mem_pool_t *pool, h2o_iovec_t para
if (params_vec->capacity == params_vec->size)
h2o_vector_reserve(pool, params_vec, params_vec->capacity + KEY_VAL_BUFFER_GROWTH_STEP);
- params_vec->entries[params_vec->size++] = param;
+ params_vec->entries[params_vec->size++] = param;
}
return params_vec;
diff --git a/web/server/h2o/h2o_utils.h b/src/web/server/h2o/h2o_utils.h
index 6760ed9a9..6760ed9a9 100644
--- a/web/server/h2o/h2o_utils.h
+++ b/src/web/server/h2o/h2o_utils.h
diff --git a/web/server/h2o/http_server.c b/src/web/server/h2o/http_server.c
index 08ad120b1..a079c6afe 100644
--- a/web/server/h2o/http_server.c
+++ b/src/web/server/h2o/http_server.c
@@ -1,10 +1,16 @@
// SPDX-License-Identifier: GPL-3.0-or-later
+#include "daemon/common.h"
#include "streaming/common.h"
#include "http_server.h"
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#pragma GCC diagnostic ignored "-Wtype-limits"
#include "h2o.h"
#include "h2o/http1.h"
+#pragma GCC diagnostic pop
#include "streaming.h"
#include "h2o_utils.h"
@@ -198,6 +204,7 @@ static inline int _netdata_uberhandler(h2o_req_t *req, RRDHOST **host)
if (!api_command.len)
return 1;
+ // TODO - get a web_client from the cache
// this (emulating struct web_client) is a hack and will be removed
// in future PRs but needs bigger changes in old http_api_v1
// we need to make the web_client_api_request_v1 to be web server
@@ -210,7 +217,8 @@ static inline int _netdata_uberhandler(h2o_req_t *req, RRDHOST **host)
w.response.header = buffer_create(NBUF_INITIAL_SIZE_RESP, NULL);
w.url_query_string_decoded = buffer_create(NBUF_INITIAL_SIZE_RESP, NULL);
w.url_as_received = buffer_create(NBUF_INITIAL_SIZE_RESP, NULL);
- w.acl = WEB_CLIENT_ACL_DASHBOARD;
+ w.port_acl = HTTP_ACL_H2O | HTTP_ACL_ALL_FEATURES;
+ w.acl = w.port_acl; // TODO - web_client_update_acl_matches(w) to restrict this based on user configuration
char *path_c_str = iovec_to_cstr(&api_command);
char *path_unescaped = url_unescape(path_c_str);
@@ -233,14 +241,19 @@ static inline int _netdata_uberhandler(h2o_req_t *req, RRDHOST **host)
web_client_api_request_v1(*host, &w, path_unescaped);
freez(path_unescaped);
- h2o_iovec_t body = buffer_to_h2o_iovec(w.response.data);
-
// we move msg body to req->pool managed memory as it has to
// live until whole response has been encrypted and sent
// when req is finished memory will be freed with the pool
- void *managed = h2o_mem_alloc_shared(&req->pool, body.len, NULL);
- memcpy(managed, body.base, body.len);
- body.base = managed;
+ h2o_iovec_t body;
+ {
+ BUFFER *wb = w.response.data;
+ body.base = wb->buffer;
+ body.len = wb->len;
+
+ void *managed = h2o_mem_alloc_shared(&req->pool, body.len, NULL);
+ memcpy(managed, body.base, body.len);
+ body.base = managed;
+ }
req->res.status = HTTP_RESP_OK;
req->res.reason = "OK";
@@ -350,8 +363,6 @@ void *h2o_main(void *ptr) {
h2o_pathconf_t *pathconf;
h2o_hostconf_t *hostconf;
- netdata_thread_disable_cancelability();
-
const char *bind_addr = config_get(HTTPD_CONFIG_SECTION, "bind to", "127.0.0.1");
int bind_port = config_get_number(HTTPD_CONFIG_SECTION, "port", 19998);
diff --git a/web/server/h2o/http_server.h b/src/web/server/h2o/http_server.h
index 79e45e13b..28d1c560a 100644
--- a/web/server/h2o/http_server.h
+++ b/src/web/server/h2o/http_server.h
@@ -3,7 +3,7 @@
#ifndef HTTP_SERVER_H
#define HTTP_SERVER_H
-#include "libnetdata/libnetdata.h"
+#include <stddef.h>
void *h2o_main(void * ptr);
diff --git a/web/server/h2o/streaming.c b/src/web/server/h2o/streaming.c
index 063e487af..fbe3f8050 100644
--- a/web/server/h2o/streaming.c
+++ b/src/web/server/h2o/streaming.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later
+#include "daemon/common.h"
#include "streaming.h"
#include "connlist.h"
#include "h2o_utils.h"
@@ -138,9 +139,10 @@ static void stream_on_recv(h2o_socket_t *sock, const char *err)
#define STREAM_METHOD "STREAM "
#define USER_AGENT "User-Agent: "
-#define NEED_MIN_BYTES(buf, bytes) \
-if (rbuf_bytes_available(buf) < bytes) \
- return GIMME_MORE_OF_DEM_SWEET_BYTEZ;
+#define NEED_MIN_BYTES(buf, bytes) do { \
+ if(rbuf_bytes_available(buf) < bytes) \
+ return GIMME_MORE_OF_DEM_SWEET_BYTEZ;\
+} while(0)
// TODO check in streaming code this is probably defined somewhere already
#define MAX_LEN_STREAM_HELLO (1024*2)
diff --git a/web/server/h2o/streaming.h b/src/web/server/h2o/streaming.h
index ae6447257..dfc7b68fc 100644
--- a/web/server/h2o/streaming.h
+++ b/src/web/server/h2o/streaming.h
@@ -3,9 +3,14 @@
#ifndef HTTPD_STREAMING_H
#define HTTPD_STREAMING_H
-#include "daemon/common.h"
-#include "mqtt_websockets/c-rbuf/include/ringbuffer.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"
+#pragma GCC diagnostic ignored "-Wtype-limits"
#include "h2o.h"
+#pragma GCC diagnostic pop
typedef enum {
STREAM_X_HTTP_1_1 = 0,