Implement mg_http_parse_header2()

Which is a replacement of (deprecated) `mg_http_parse_header`, but,
similarly to `asprintf`, allocates a new buffer if the client-provided
one is not large enough.

Also use it throughout mongoose code, and thus some header-related
limitations are removed; in particular,
https://github.com/cesanta/mongoose/issues/813 is fixed.

CL: Mongoose Web Server: Deprecate `mg_http_parse_header()` and implement `mg_http_parse_header2()` instead, which allocates a new buffer if the client-provided one is not large enough (similarly to `asprintf`).
CL: Mongoose Web Server: Fix limitations of header value lengths, e.g. when parsing authentication headers such as nonce, etc.

PUBLISHED_FROM=c75b1bbbbdb294ea85075ce69b1368f115fdd1ef
This commit is contained in:
Dmitry Frank authored and Cesanta Bot committed 2018-02-07 23:04:29 +00:00
1 parent a8a7d2cf7e
commit b9b20c6494
10 files changed
+541 -109

No files matched your search

+3 -1
View File
@@ -45,7 +45,9 @@ COMMON_FEATURE_FLAGS = \
-DMG_ENABLE_SNTP -DMG_SNTP_NO_DELAY_CORRECTION \
-DMG_ENABLE_HTTP_STREAMING_MULTIPART
UNIX_FEATURE_FLAGS=-DMG_ENABLE_IPV6 -DMG_ENABLE_SSL
CFLAGS = -W -Wall -Wundef -Werror -g -O0 -Wno-multichar -D__USE_MISC \
# TODO: remove -Wno-deprecated-declarations once deprecated
# `mg_http_parse_header()` is removed from mongoose.
CFLAGS = -W -Wall -Wundef -Werror -Wno-deprecated-declarations -g -O0 -Wno-multichar -D__USE_MISC \
$(COMMON_FEATURE_FLAGS) $(UNIX_FEATURE_FLAGS) \
$(patsubst %,-I%,$(subst :, ,$(VPATH))) \
-include unit_test.h -pthread $(CFLAGS_EXTRA)