From 17947d5f44a434dfe91bf3d8cec41e3eadbbd709 Mon Sep 17 00:00:00 2001 From: Lauri Kasanen Date: Tue, 8 Nov 2022 18:16:16 +0200 Subject: [PATCH] Add support for custom response headers --- common/network/websocket.c | 88 ++++++++++++++++++++++++------------ unix/xserver/hw/vnc/Xvnc.man | 5 ++ unix/xserver/hw/vnc/xvnc.c | 55 ++++++++++++++++++++++ 3 files changed, 118 insertions(+), 30 deletions(-) diff --git a/common/network/websocket.c b/common/network/websocket.c index 2325cb9..52c5183 100644 --- a/common/network/websocket.c +++ b/common/network/websocket.c @@ -46,6 +46,9 @@ settings_t settings; extern int wakeuppipe[2]; +extern char *extra_headers; +extern unsigned extra_headers_len; + void traffic(const char * token) { /*if ((settings.verbose) && (! settings.daemon)) { fprintf(stdout, "%s", token); @@ -836,7 +839,8 @@ static void dirlisting(ws_ctx_t *ws_ctx, const char fullpath[], const char path[ "Location: %s/\r\n" "Connection: close\r\n" "Content-type: text/plain\r\n" - "\r\n", path); + "%s" + "\r\n", path, extra_headers ? extra_headers : ""); ws_send(ws_ctx, buf, strlen(buf)); weblog(301, wsthread_handler_id, 0, origip, ip, user, 1, path, strlen(buf)); return; @@ -850,7 +854,9 @@ static void dirlisting(ws_ctx_t *ws_ctx, const char fullpath[], const char path[ "Server: KasmVNC/4.0\r\n" "Connection: close\r\n" "Content-type: text/html\r\n" - "\r\nDirectory Listing

%s