diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/microhttpd/postprocessor.c | 52 |
2 files changed, 7 insertions, 49 deletions
@@ -1,3 +1,7 @@ | |||
1 | Thu 04 Feb 2021 06:41:34 PM CET | ||
2 | Fix PostProcessor to always properly stop iteration when application callback | ||
3 | tells it to do so. -CG | ||
4 | |||
1 | Wed 06 Jan 2021 08:39:58 PM CET | 5 | Wed 06 Jan 2021 08:39:58 PM CET |
2 | Return timeout of zero also for connections awaiting cleanup. -CG | 6 | Return timeout of zero also for connections awaiting cleanup. -CG |
3 | 7 | ||
diff --git a/src/microhttpd/postprocessor.c b/src/microhttpd/postprocessor.c index e6f0a9a7..aea78def 100644 --- a/src/microhttpd/postprocessor.c +++ b/src/microhttpd/postprocessor.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libmicrohttpd | 2 | This file is part of libmicrohttpd |
3 | Copyright (C) 2007-2013 Daniel Pittman and Christian Grothoff | 3 | Copyright (C) 2007-2021 Daniel Pittman and Christian Grothoff |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | 6 | modify it under the terms of the GNU Lesser General Public |
@@ -251,31 +251,6 @@ struct MHD_PostProcessor | |||
251 | }; | 251 | }; |
252 | 252 | ||
253 | 253 | ||
254 | /** | ||
255 | * Create a `struct MHD_PostProcessor`. | ||
256 | * | ||
257 | * A `struct MHD_PostProcessor` can be used to (incrementally) parse | ||
258 | * the data portion of a POST request. Note that some buggy browsers | ||
259 | * fail to set the encoding type. If you want to support those, you | ||
260 | * may have to call #MHD_set_connection_value with the proper encoding | ||
261 | * type before creating a post processor (if no supported encoding | ||
262 | * type is set, this function will fail). | ||
263 | * | ||
264 | * @param connection the connection on which the POST is | ||
265 | * happening (used to determine the POST format) | ||
266 | * @param buffer_size maximum number of bytes to use for | ||
267 | * internal buffering (used only for the parsing, | ||
268 | * specifically the parsing of the keys). A | ||
269 | * tiny value (256-1024) should be sufficient. | ||
270 | * Do NOT use a value smaller than 256. For good | ||
271 | * performance, use 32 or 64k (i.e. 65536). | ||
272 | * @param iter iterator to be called with the parsed data, | ||
273 | * Must NOT be NULL. | ||
274 | * @param iter_cls first argument to @a iter | ||
275 | * @return NULL on error (out of memory, unsupported encoding), | ||
276 | * otherwise a PP handle | ||
277 | * @ingroup request | ||
278 | */ | ||
279 | struct MHD_PostProcessor * | 254 | struct MHD_PostProcessor * |
280 | MHD_create_post_processor (struct MHD_Connection *connection, | 255 | MHD_create_post_processor (struct MHD_Connection *connection, |
281 | size_t buffer_size, | 256 | size_t buffer_size, |
@@ -661,6 +636,8 @@ post_process_urlencoded (struct MHD_PostProcessor *pp, | |||
661 | start_value, | 636 | start_value, |
662 | end_value, | 637 | end_value, |
663 | NULL); | 638 | NULL); |
639 | if (PP_Error == pp->state) | ||
640 | continue; | ||
664 | pp->value_offset = 0; | 641 | pp->value_offset = 0; |
665 | start_value = NULL; | 642 | start_value = NULL; |
666 | end_value = NULL; | 643 | end_value = NULL; |
@@ -1408,19 +1385,6 @@ END: | |||
1408 | } | 1385 | } |
1409 | 1386 | ||
1410 | 1387 | ||
1411 | /** | ||
1412 | * Parse and process POST data. Call this function when POST data is | ||
1413 | * available (usually during an #MHD_AccessHandlerCallback) with the | ||
1414 | * "upload_data" and "upload_data_size". Whenever possible, this will | ||
1415 | * then cause calls to the #MHD_PostDataIterator. | ||
1416 | * | ||
1417 | * @param pp the post processor | ||
1418 | * @param post_data @a post_data_len bytes of POST data | ||
1419 | * @param post_data_len length of @a post_data | ||
1420 | * @return #MHD_YES on success, #MHD_NO on error | ||
1421 | * (out-of-memory, iterator aborted, parse error) | ||
1422 | * @ingroup request | ||
1423 | */ | ||
1424 | enum MHD_Result | 1388 | enum MHD_Result |
1425 | MHD_post_process (struct MHD_PostProcessor *pp, | 1389 | MHD_post_process (struct MHD_PostProcessor *pp, |
1426 | const char *post_data, | 1390 | const char *post_data, |
@@ -1449,16 +1413,6 @@ MHD_post_process (struct MHD_PostProcessor *pp, | |||
1449 | } | 1413 | } |
1450 | 1414 | ||
1451 | 1415 | ||
1452 | /** | ||
1453 | * Release PostProcessor resources. | ||
1454 | * | ||
1455 | * @param pp post processor context to destroy | ||
1456 | * @return #MHD_YES if processing completed nicely, | ||
1457 | * #MHD_NO if there were spurious characters / formatting | ||
1458 | * problems; it is common to ignore the return | ||
1459 | * value of this function | ||
1460 | * @ingroup request | ||
1461 | */ | ||
1462 | enum MHD_Result | 1416 | enum MHD_Result |
1463 | MHD_destroy_post_processor (struct MHD_PostProcessor *pp) | 1417 | MHD_destroy_post_processor (struct MHD_PostProcessor *pp) |
1464 | { | 1418 | { |