Skip to content

Commit

Permalink
Minor changes in http.c and gui-warp.app
Browse files Browse the repository at this point in the history
  • Loading branch information
mezantrop committed Oct 5, 2023
1 parent 1defea2 commit 6eec508
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
12 changes: 8 additions & 4 deletions gui/ports/macOS/gui-warp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions http.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6eec508

Please sign in to comment.