aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/postprocessor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/postprocessor.c')
-rw-r--r--src/microhttpd/postprocessor.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/src/microhttpd/postprocessor.c b/src/microhttpd/postprocessor.c
index 6cd6d82d..dfdf2a50 100644
--- a/src/microhttpd/postprocessor.c
+++ b/src/microhttpd/postprocessor.c
@@ -244,10 +244,14 @@ struct MHD_PostProcessor
244 244
245 245
246/** 246/**
247 * Create a PostProcessor. 247 * Create a `struct MHD_PostProcessor`.
248 * 248 *
249 * A PostProcessor can be used to (incrementally) 249 * A `struct MHD_PostProcessor` can be used to (incrementally) parse
250 * parse the data portion of a POST request. 250 * the data portion of a POST request. Note that some buggy browsers
251 * fail to set the encoding type. If you want to support those, you
252 * may have to call #MHD_set_connection_value with the proper encoding
253 * type before creating a post processor (if no supported encoding
254 * type is set, this function will fail).
251 * 255 *
252 * @param connection the connection on which the POST is 256 * @param connection the connection on which the POST is
253 * happening (used to determine the POST format) 257 * happening (used to determine the POST format)
@@ -255,11 +259,14 @@ struct MHD_PostProcessor
255 * internal buffering (used only for the parsing, 259 * internal buffering (used only for the parsing,
256 * specifically the parsing of the keys). A 260 * specifically the parsing of the keys). A
257 * tiny value (256-1024) should be sufficient. 261 * tiny value (256-1024) should be sufficient.
258 * Do NOT use 0. 262 * Do NOT use a value smaller than 256. For good
259 * @param iter iterator to be called with the parsed data 263 * performance, use 32 or 64k (i.e. 65536).
260 * @param iter_cls first argument to iter 264 * @param iter iterator to be called with the parsed data,
265 * Must NOT be NULL.
266 * @param iter_cls first argument to @a iter
261 * @return NULL on error (out of memory, unsupported encoding), 267 * @return NULL on error (out of memory, unsupported encoding),
262 * otherwise a PP handle 268 * otherwise a PP handle
269 * @ingroup request
263 */ 270 */
264struct MHD_PostProcessor * 271struct MHD_PostProcessor *
265MHD_create_post_processor (struct MHD_Connection *connection, 272MHD_create_post_processor (struct MHD_Connection *connection,
@@ -1082,26 +1089,25 @@ END:
1082 1089
1083 1090
1084/** 1091/**
1085 * Parse and process POST data. 1092 * Parse and process POST data. Call this function when POST data is
1086 * Call this function when POST data is available 1093 * available (usually during an #MHD_AccessHandlerCallback) with the
1087 * (usually during an MHD_AccessHandlerCallback) 1094 * "upload_data" and "upload_data_size". Whenever possible, this will
1088 * with the upload_data and upload_data_size. 1095 * then cause calls to the #MHD_IncrementalKeyValueIterator.
1089 * Whenever possible, this will then cause calls
1090 * to the MHD_IncrementalKeyValueIterator.
1091 * 1096 *
1092 * @param pp the post processor 1097 * @param pp the post processor
1093 * @param post_data post_data_len bytes of POST data 1098 * @param post_data @a post_data_len bytes of POST data
1094 * @param post_data_len length of post_data 1099 * @param post_data_len length of @a post_data
1095 * @return MHD_YES on success, MHD_NO on error 1100 * @return #MHD_YES on success, #MHD_NO on error
1096 * (out-of-memory, iterator aborted, parse error) 1101 * (out-of-memory, iterator aborted, parse error)
1102 * @ingroup request
1097 */ 1103 */
1098int 1104int
1099MHD_post_process (struct MHD_PostProcessor *pp, 1105MHD_post_process (struct MHD_PostProcessor *pp,
1100 const char *post_data, size_t post_data_len) 1106 const char *post_data, size_t post_data_len)
1101{ 1107{
1102 if (post_data_len == 0) 1108 if (0 == post_data_len)
1103 return MHD_YES; 1109 return MHD_YES;
1104 if (pp == NULL) 1110 if (NULL == pp)
1105 return MHD_NO; 1111 return MHD_NO;
1106 if (0 == strncasecmp (MHD_HTTP_POST_ENCODING_FORM_URLENCODED, pp->encoding, 1112 if (0 == strncasecmp (MHD_HTTP_POST_ENCODING_FORM_URLENCODED, pp->encoding,
1107 strlen(MHD_HTTP_POST_ENCODING_FORM_URLENCODED))) 1113 strlen(MHD_HTTP_POST_ENCODING_FORM_URLENCODED)))
@@ -1119,10 +1125,11 @@ MHD_post_process (struct MHD_PostProcessor *pp,
1119 * Release PostProcessor resources. 1125 * Release PostProcessor resources.
1120 * 1126 *
1121 * @param pp post processor context to destroy 1127 * @param pp post processor context to destroy
1122 * @return MHD_YES if processing completed nicely, 1128 * @return #MHD_YES if processing completed nicely,
1123 * MHD_NO if there were spurious characters / formatting 1129 * #MHD_NO if there were spurious characters / formatting
1124 * problems; it is common to ignore the return 1130 * problems; it is common to ignore the return
1125 * value of this function 1131 * value of this function
1132 * @ingroup request
1126 */ 1133 */
1127int 1134int
1128MHD_destroy_post_processor (struct MHD_PostProcessor *pp) 1135MHD_destroy_post_processor (struct MHD_PostProcessor *pp)