From 6eec508a4431a1b99210c1e9d002f99c85d79ed3 Mon Sep 17 00:00:00 2001 From: Mikhail Zakharov Date: Thu, 5 Oct 2023 19:25:36 +0200 Subject: [PATCH] Minor changes in `http.c` and `gui-warp.app` --- CHANGELOG.md | 4 +++- gui/ports/macOS/gui-warp.py | 12 ++++++++---- http.c | 5 +++-- version.h | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dffaa9..1c76c56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # CHANGELOG -* 2023.10.04 Current +* 2023.10.05 Current + * `http.c`: `http_server_request()` special buffer for replies + * `gui-warp.app`: Create missed leafs of configuration directory tree if they are not exist * `socks.c`: Finish only client processes on Socks errors * `http.c`: `http_server_request()` reply the same protocol as in the request diff --git a/gui/ports/macOS/gui-warp.py b/gui/ports/macOS/gui-warp.py index 0165cd4..2a7bfa1 100644 --- a/gui/ports/macOS/gui-warp.py +++ b/gui/ports/macOS/gui-warp.py @@ -53,7 +53,7 @@ def __init__(self, width=800, height=560, self.password = '' - self.version = 'v1.0.17-mac' + self.version = 'v1.0.18-mac' self.width = width self.height = height @@ -348,12 +348,16 @@ def get_password(self): if not os.path.exists(prefix): # Create ts-warp dir + subdirs in home os.makedirs(prefix + 'etc/') + shutil.copyfile('./ts-warp.ini', inifile) # Install sample INI + os.chmod(inifile, 0o600) + if not os.path.exists(prefix + 'etc/'): + os.makedirs(prefix + 'etc/') + if not os.path.exists(prefix + 'var/log/'): os.makedirs(prefix + 'var/log/') + if not os.path.exists(prefix + 'var/run/'): os.makedirs(prefix + 'var/run/') + if not os.path.exists(prefix + 'var/spool/ts-warp/'): os.makedirs(prefix + 'var/spool/ts-warp/') - - shutil.copyfile('./ts-warp.ini', inifile) # Install sam ple INI - os.chmod(inifile, 0o600) if not os.path.exists(fwfile): with open(fwfile, "w") as outfw: diff --git a/http.c b/http.c index 36ddbf9..54476b3 100644 --- a/http.c +++ b/http.c @@ -42,6 +42,7 @@ extern char *pfile_name; /* ------------------------------------------------------------------------------------------------------------------ */ int http_server_request(int socket, struct uvaddr *daddr) { char buf[64 * BUF_SIZE_1KB] = {0}; + char rbuf[STR_SIZE] = {0}; int rcount; char *method = NULL, *url = NULL, *proto = NULL; @@ -79,8 +80,8 @@ int http_server_request(int socket, struct uvaddr *daddr) { else SIN6_PORT(daddr->ip_addr) = port; /* TODO: Check connection; Reply real status */ - snprintf(buf, sizeof(buf), "%s %s OK\r\nProxy-agent: %s\r\n\r\n", proto, HTTP_RESPONSE_200, PROG_NAME_FULL); - if (send(socket, buf, strlen(buf), 0) == -1) { + snprintf(rbuf, sizeof(rbuf), "%s %s OK\r\nProxy-agent: %s\r\n\r\n", proto, HTTP_RESPONSE_200, PROG_NAME_FULL); + if (send(socket, rbuf, strlen(rbuf), 0) == -1) { printl(LOG_CRIT, "Unable to send reply to the HTTP client"); return 1; } diff --git a/version.h b/version.h index d662c48..51f8acf 100644 --- a/version.h +++ b/version.h @@ -29,7 +29,7 @@ #define PROG_NAME_SHORT "TSW" #define PROG_VERSION_MAJOR "1" #define PROG_VERSION_MINOR "3" -#define PROG_VERSION_BUILD "11" +#define PROG_VERSION_BUILD "12" #define PROG_VERSION PROG_VERSION_MAJOR "." PROG_VERSION_MINOR "." PROG_VERSION_BUILD #define PROG_NAME_FULL PROG_NAME " " PROG_VERSION #define PROG_NAME_CODE PROG_NAME_SHORT PROG_VERSION