From 5f59b7e74728065b2c24c5cbc5fdc74e779d4f9c Mon Sep 17 00:00:00 2001 From: Deomid Ryabkov <rojer@cesanta.com> Date: Wed, 30 Mar 2016 00:22:28 +0200 Subject: [PATCH] Enable SSI on CC3200 (w/o exec) Disable CGI automatically, as it's never going to work. PUBLISHED_FROM=37d7abc54be4637dfec5031bc3398e97a1be3090 --- examples/CC3200/Makefile.build | 2 -- mongoose.c | 8 +++++--- mongoose.h | 4 ++++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/CC3200/Makefile.build b/examples/CC3200/Makefile.build index 43317c262..e2a057e1b 100644 --- a/examples/CC3200/Makefile.build +++ b/examples/CC3200/Makefile.build @@ -28,8 +28,6 @@ MONGOOSE_FEATURES = \ -DMG_DISABLE_JSON_RPC \ -DMG_DISABLE_COAP \ -DMG_DISABLE_DAV \ - -DMG_DISABLE_CGI \ - -DMG_DISABLE_SSI \ -DMG_ENABLE_HTTP_STREAMING_MULTIPART \ -DMG_MAX_HTTP_HEADERS=20 \ -DMG_MAX_HTTP_REQUEST_SIZE=1024 \ diff --git a/mongoose.c b/mongoose.c index b6edb8def..52af87e9d 100644 --- a/mongoose.c +++ b/mongoose.c @@ -5710,14 +5710,14 @@ static void mg_send_ssi_file(struct mg_connection *nc, const char *path, static const struct mg_str d_exec = MG_MK_STR("exec"); #endif char buf[BUFSIZ], *p = buf + btag.len; /* p points to SSI directive */ - int ch, offset, len, in_ssi_tag; + int ch, len, in_ssi_tag; if (include_level > 10) { mg_printf(nc, "SSI #include level is too deep (%s)", path); return; } - in_ssi_tag = len = offset = 0; + in_ssi_tag = len = 0; while ((ch = fgetc(fp)) != EOF) { if (in_ssi_tag && ch == '>' && buf[len - 1] == '-' && buf[len - 2] == '-') { size_t i = len - 2; @@ -7838,8 +7838,10 @@ void *mg_start_thread(void *(*f)(void *), void *p) { void mg_set_close_on_exec(sock_t sock) { #ifdef _WIN32 (void) SetHandleInformation((HANDLE) sock, HANDLE_FLAG_INHERIT, 0); -#else +#elif defined(__unix__) fcntl(sock, F_SETFD, FD_CLOEXEC); +#else + (void) sock; #endif } diff --git a/mongoose.h b/mongoose.h index 99517f4ab..2a827edf2 100644 --- a/mongoose.h +++ b/mongoose.h @@ -397,6 +397,8 @@ unsigned long os_random(void); #define MG_SOCKET_SIMPLELINK 1 #define MG_DISABLE_SOCKETPAIR 1 #define MG_DISABLE_SYNC_RESOLVER 1 +#define MG_DISABLE_POPEN 1 +#define MG_DISABLE_CGI 1 #include <simplelink.h> @@ -543,6 +545,8 @@ typedef struct stat cs_stat_t; #define closesocket(x) sl_Close(x) +#define fileno(x) -1 + /* Some functions we implement for Mongoose. */ const char *inet_ntop(int af, const void *src, char *dst, socklen_t size); -- GitLab