From 7372a05ce51accd9984e210f0a5ac3d3213f25ed Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Wed, 30 Mar 2022 07:56:44 +0100 Subject: [PATCH] Add initial Zephyr support --- mongoose.c | 12 ++++++++---- mongoose.h | 31 +++++++++++++++++++++++++++++++ src/arch.h | 4 ++++ src/sock.c | 2 +- src/ssi.c | 10 +++++++--- 5 files changed, 51 insertions(+), 8 deletions(-) diff --git a/mongoose.c b/mongoose.c index c2735ddc..dad28bf4 100644 --- a/mongoose.c +++ b/mongoose.c @@ -3448,7 +3448,7 @@ static void setsockopts(struct mg_connection *c) { if (setsockopt(FD(c), IPPROTO_TCP, TCP_KEEPIDLE, &idle, sizeof(idle)) != 0) (void) 0; #endif -#if MG_ARCH != MG_ARCH_WIN32 && !defined(__QNX__) +#if MG_ARCH != MG_ARCH_WIN32 && !defined(__QNX__) && MG_ARCH != MG_ARCH_ZEPHYR { int cnt = 3, intvl = 20; if (setsockopt(FD(c), IPPROTO_TCP, TCP_KEEPCNT, &cnt, sizeof(cnt)) != 0) @@ -3712,19 +3712,23 @@ void mg_mgr_poll(struct mg_mgr *mgr, int ms) { #define MG_MAX_SSI_DEPTH 5 #endif +#ifndef MG_SSI_BUFSIZ +#define MG_SSI_BUFSIZ 1024 +#endif + #if MG_ENABLE_SSI static char *mg_ssi(const char *path, const char *root, int depth) { struct mg_iobuf b = {NULL, 0, 0}; FILE *fp = fopen(path, "rb"); if (fp != NULL) { - char buf[BUFSIZ] = "", arg[sizeof(buf)] = ""; + char buf[MG_SSI_BUFSIZ] = "", arg[sizeof(buf)] = ""; int ch, intag = 0; size_t len = 0, align = MG_IO_SIZE; while ((ch = fgetc(fp)) != EOF) { if (intag && ch == '>' && buf[len - 1] == '-' && buf[len - 2] == '-') { buf[len++] = (char) (ch & 0xff); if (sscanf(buf, "