From fe0d340c034f7454707574972642f0b8e8c2f3ce Mon Sep 17 00:00:00 2001 From: Deomid Ryabkov <rojer@cesanta.com> Date: Fri, 1 Apr 2016 15:01:36 +0100 Subject: [PATCH] Tighten Mongoose footprint defaults Explicitly loosen them on the "big" platforms. PUBLISHED_FROM=b4786428402c5da55738d3f7085ab12acf884e74 --- examples/CC3200/Makefile.build | 9 +------ examples/ESP8266_RTOS/user/Makefile | 2 -- mongoose.h | 37 +++++++++++++++++++++++++---- 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/examples/CC3200/Makefile.build b/examples/CC3200/Makefile.build index 2e2c8f808..257c75377 100644 --- a/examples/CC3200/Makefile.build +++ b/examples/CC3200/Makefile.build @@ -23,14 +23,7 @@ IPATH = . ../.. $(REPO_PATH) VPATH = ../.. -MONGOOSE_FEATURES = \ - -DMG_DISABLE_DIRECTORY_LISTING \ - -DMG_DISABLE_DAV \ - -DMG_ENABLE_HTTP_STREAMING_MULTIPART \ - -DMG_MAX_HTTP_HEADERS=20 \ - -DMG_MAX_HTTP_REQUEST_SIZE=1024 \ - -DMG_MAX_PATH=40 \ - -DMG_MAX_HTTP_SEND_MBUF=1024 +MONGOOSE_FEATURES = -DMG_ENABLE_HTTP_STREAMING_MULTIPART SDK_FLAGS = -DUSE_FREERTOS -DSL_PLATFORM_MULTI_THREADED # -DTARGET_IS_CC3200 would reduce code size by using functions in ROM diff --git a/examples/ESP8266_RTOS/user/Makefile b/examples/ESP8266_RTOS/user/Makefile index 20c4e882e..85700bed3 100644 --- a/examples/ESP8266_RTOS/user/Makefile +++ b/examples/ESP8266_RTOS/user/Makefile @@ -26,8 +26,6 @@ endif DEFINES += -DCS_PLATFORM=3 \ -DMG_NO_BSD_SOCKETS \ -DMG_DISABLE_FILESYSTEM \ - -DMG_MAX_HTTP_HEADERS=20 -DMG_MAX_HTTP_REQUEST_SIZE=1024 \ - -DMG_MAX_PATH=40 -DMG_MAX_HTTP_SEND_MBUF=1024 \ -DRTOS_SDK -DMG_LWIP -DLWIP_TIMEVAL_PRIVATE=0 \ -DMG_INTERNAL= diff --git a/mongoose.h b/mongoose.h index 8022adae4..f357a25fe 100644 --- a/mongoose.h +++ b/mongoose.h @@ -239,6 +239,18 @@ struct dirent *readdir(DIR *dir); #endif #endif +#ifndef MG_MAX_HTTP_REQUEST_SIZE +#define MG_MAX_HTTP_REQUEST_SIZE 8192 +#endif + +#ifndef MG_MAX_HTTP_SEND_MBUF +#define MG_MAX_HTTP_SEND_MBUF 4096 +#endif + +#ifndef MG_MAX_HTTP_HEADERS +#define MG_MAX_HTTP_HEADERS 40 +#endif + #endif /* CS_PLATFORM == CS_P_WINDOWS */ #endif /* CS_COMMON_PLATFORMS_PLATFORM_WINDOWS_H_ */ #ifndef CS_COMMON_PLATFORMS_PLATFORM_UNIX_H_ @@ -322,6 +334,18 @@ typedef struct stat cs_stat_t; #define closesocket(x) close(x) +#ifndef MG_MAX_HTTP_REQUEST_SIZE +#define MG_MAX_HTTP_REQUEST_SIZE 8192 +#endif + +#ifndef MG_MAX_HTTP_SEND_MBUF +#define MG_MAX_HTTP_SEND_MBUF 4096 +#endif + +#ifndef MG_MAX_HTTP_HEADERS +#define MG_MAX_HTTP_HEADERS 40 +#endif + #endif /* CS_PLATFORM == CS_P_UNIX */ #endif /* CS_COMMON_PLATFORMS_PLATFORM_UNIX_H_ */ #ifndef CS_COMMON_PLATFORMS_PLATFORM_ESP_LWIP_H_ @@ -401,6 +425,11 @@ unsigned long os_random(void); #define MG_DISABLE_SYNC_RESOLVER 1 #define MG_DISABLE_POPEN 1 #define MG_DISABLE_CGI 1 +/* Only SPIFFS supports directories, SLFS does not. */ +#ifndef CC3200_FS_SPIFFS +#define MG_DISABLE_DAV 1 +#define MG_DISABLE_DIRECTORY_LISTING 1 +#endif #include <simplelink/include/simplelink.h> @@ -1922,23 +1951,23 @@ extern "C" { #endif /* __cplusplus */ #ifndef MG_MAX_HTTP_HEADERS -#define MG_MAX_HTTP_HEADERS 40 +#define MG_MAX_HTTP_HEADERS 20 #endif #ifndef MG_MAX_HTTP_REQUEST_SIZE -#define MG_MAX_HTTP_REQUEST_SIZE 8192 +#define MG_MAX_HTTP_REQUEST_SIZE 1024 #endif #ifndef MG_MAX_PATH #ifdef PATH_MAX #define MG_MAX_PATH PATH_MAX #else -#define MG_MAX_PATH 1024 +#define MG_MAX_PATH 256 #endif #endif #ifndef MG_MAX_HTTP_SEND_MBUF -#define MG_MAX_HTTP_SEND_MBUF 4096 +#define MG_MAX_HTTP_SEND_MBUF 1024 #endif #ifndef MG_WEBSOCKET_PING_INTERVAL_SECONDS -- GitLab