summaryrefslogtreecommitdiffstats
path: root/libnetdata
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@netdata.cloud>2023-06-26 11:37:47 +0300
committerGitHub <noreply@github.com>2023-06-26 11:37:47 +0300
commitff0b64dce2abb1f4e77cffaeb4a954fd5f985326 (patch)
tree19c23d24cc3031141edcf3506121e161dbd83276 /libnetdata
parentd548db0f14e380f18ff0c1bb6764a59b29bda008 (diff)
URL rewrite at the agent web server to support multiple dashboard versions (#15247)
* new routing for web requests * renamed and better error control * add missing return statements * do not serve files when no file extension is given * restore the api of the functions; use internal web_client flags to keep state; support redirects to fix directories * add window.location.hash to url redirect * do not redirect when sending to specific dashboard version and there are data after the version * uniform function to append slash to URL * remove obsolete proxy https flag
Diffstat (limited to 'libnetdata')
-rw-r--r--libnetdata/buffer/buffer.h17
-rw-r--r--libnetdata/http/http_defs.h1
2 files changed, 8 insertions, 10 deletions
diff --git a/libnetdata/buffer/buffer.h b/libnetdata/buffer/buffer.h
index 0021c38ff6..5aaa26a079 100644
--- a/libnetdata/buffer/buffer.h
+++ b/libnetdata/buffer/buffer.h
@@ -242,19 +242,16 @@ static inline void buffer_strncat(BUFFER *wb, const char *txt, size_t len) {
if(unlikely(!txt || !*txt)) return;
const char *t = txt;
- while(*t) {
- buffer_need_bytes(wb, len);
- char *s = &wb->buffer[wb->len];
- char *d = s;
- const char *e = &wb->buffer[wb->len + len];
+ buffer_need_bytes(wb, len + 1);
+ char *s = &wb->buffer[wb->len];
+ char *d = s;
+ const char *e = &wb->buffer[wb->len + len];
- while(*t && d < e)
- *d++ = *t++;
+ while(*t && d < e)
+ *d++ = *t++;
- wb->len += d - s;
- }
+ wb->len += d - s;
- buffer_need_bytes(wb, 1);
wb->buffer[wb->len] = '\0';
buffer_overflow_check(wb);
diff --git a/libnetdata/http/http_defs.h b/libnetdata/http/http_defs.h
index 774ea0b71d..906e3bdfb2 100644
--- a/libnetdata/http/http_defs.h
+++ b/libnetdata/http/http_defs.h
@@ -10,6 +10,7 @@
#define HTTP_RESP_MOVED_PERM 301
#define HTTP_RESP_REDIR_TEMP 307
#define HTTP_RESP_REDIR_PERM 308
+#define HTTP_RESP_HTTPS_UPGRADE 399
// HTTP_CODES 4XX Client Errors
#define HTTP_RESP_BAD_REQUEST 400