libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit dcc7066746037f61e9645b70d6526a44efdba093
parent 535985fe1c4cd920c2d042fa810753a6b0b9ceb8
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat, 16 Jul 2016 19:56:26 +0000

print warning if application code performing connection POST processing is buggy

Diffstat:
MChangeLog | 5+++++
Msrc/include/microhttpd.h | 2+-
Msrc/microhttpd/connection.c | 14+++++++++++++-
3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,8 @@ +Sat Jul 16 21:54:49 CEST 2016 + Warn user if they sent connection into blocking + state by not processing all POST data, not suspending, + and not running in external select mode. -CG + Fri Jul 8 21:35:07 CEST 2016 Fix FIXME in tutorial. -CG diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h @@ -130,7 +130,7 @@ typedef intptr_t ssize_t; * Current version of the library. * 0x01093001 = 1.9.30-1. */ -#define MHD_VERSION 0x00095000 +#define MHD_VERSION 0x00095001 /** * MHD-internal return code for "YES". diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -1794,7 +1794,19 @@ process_request_body (struct MHD_Connection *connection) #endif ); if (0 != processed) - instant_retry = MHD_NO; /* client did not process everything */ + { + instant_retry = MHD_NO; /* client did not process everything */ +#ifdef HAVE_MESSAGES + /* client did not process all POST data, complain if + the setup was incorrect, which may prevent us from + handling the rest of the request */ + if ( ( (0 != (connection->daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || + (0 != (connection->daemon->options & MHD_USE_SELECT_INTERNALLY)) ) && + (MHD_NO == connection->suspended) ) + MHD_DLOG (connection->daemon, + "WARNING: incomplete POST processing and connection not suspended will result in hung connection.\n"); + } +#endif used -= processed; if (connection->have_chunked_upload == MHD_YES) connection->current_chunk_offset += used;