Updated API and internal names for clarity

This commit is contained in:
Evgeny Grin (Karlson2k)
2024-08-01 16:06:42 +02:00
parent a19e044f75
commit de4e13c7ae
6 changed files with 33 additions and 26 deletions
+3 -3
View File
@@ -4823,9 +4823,9 @@ enum MHD_FLAGS_ENUM_ MHD_ValueKind
,
/**
* POST data.
* This is available only if a content encoding
* supported by MHD is used, and only if the posted content
* fits within the available memory pool.
* This is available only if #MHD_action_parse_post() action is used,
* a content encoding is supported by MHD, and only if the posted content
* fits within the specified memory buffers.
*
* @warning The encoding "multipart/form-data" has more fields than just
* "name" and "value". See #MHD_request_get_post_data_cb() and
+3 -3
View File
@@ -539,9 +539,9 @@ enum MHD_FLAGS_ENUM_ MHD_ValueKind
,
/**
* POST data.
* This is available only if a content encoding
* supported by MHD is used, and only if the posted content
* fits within the available memory pool.
* This is available only if #MHD_action_parse_post() action is used,
* a content encoding is supported by MHD, and only if the posted content
* fits within the specified memory buffers.
*
* @warning The encoding "multipart/form-data" has more fields than just
* "name" and "value". See #MHD_request_get_post_data_cb() and
+15 -8
View File
@@ -116,6 +116,7 @@ MHD_action_parse_post (struct MHD_Request *request,
MHD_PostDataFinished done_cb,
void *done_cb_cls)
{
#ifdef HAVE_POST_PARSER
struct MHD_Action *const restrict head_act =
&(request->app_act.head_act);
if (mhd_ACTION_NO_ACTION != head_act->act)
@@ -123,16 +124,22 @@ MHD_action_parse_post (struct MHD_Request *request,
if (NULL == done_cb)
return (const struct MHD_Action *) NULL;
head_act->act = mhd_ACTION_POST_PROCESS;
head_act->data.post_process.buffer_size = buffer_size;
head_act->data.post_process.auto_stream_size = auto_stream_size;
head_act->data.post_process.enc = enc;
head_act->data.post_process.stream_reader = stream_reader;
head_act->data.post_process.reader_cls = reader_cls;
head_act->data.post_process.done_cb = done_cb;
head_act->data.post_process.done_cb_cls = done_cb_cls;
head_act->act = mhd_ACTION_POST_PARSE;
head_act->data.post_parse.buffer_size = buffer_size;
head_act->data.post_parse.auto_stream_size = auto_stream_size;
head_act->data.post_parse.enc = enc;
head_act->data.post_parse.stream_reader = stream_reader;
head_act->data.post_parse.reader_cls = reader_cls;
head_act->data.post_parse.done_cb = done_cb;
head_act->data.post_parse.done_cb_cls = done_cb_cls;
return head_act;
#else /* ! HAVE_POST_PARSER */
(void) request; (void) buffer_size; (void) auto_stream_size;
(void) enc; (void) stream_reader; (void) reader_cls;
(void) done_cb; (void) done_cb_cls;
return NULL;
#endif /* ! HAVE_POST_PARSER */
}
+5 -5
View File
@@ -55,9 +55,9 @@ enum mhd_ActionType
mhd_ACTION_UPLOAD
,
/**
* Process clients upload by POST processor
* Process POST data clients upload by POST parser
*/
mhd_ACTION_POST_PROCESS
mhd_ACTION_POST_PARSE
,
/**
* Suspend requests (connection)
@@ -190,7 +190,7 @@ enum MHD_FIXED_ENUM_MHD_APP_SET_ MHD_HTTP_PostEncoding
// TODO: correct and describe
struct mhd_PostProcessorActionData
struct mhd_PostParseActionData
{
size_t buffer_size;
size_t auto_stream_size;
@@ -217,9 +217,9 @@ union mhd_ActionData
struct mhd_UploadCallbacks upload;
/**
* The data for the action #mhd_ACTION_POST_PROCESS
* The data for the action #mhd_ACTION_POST_PARSE
*/
struct mhd_PostProcessorActionData post_process;
struct mhd_PostParseActionData post_parse;
};
+1 -1
View File
@@ -36,7 +36,7 @@
/**
* Get specified field value from request
* If multiple values match the kind, return any one of them.
* If multiple values match the kind, return first found.
*
* The returned pointer is valid until the response is queued.
* If the data is needed beyond this point, it should be copied.
+6 -6
View File
@@ -2852,7 +2852,7 @@ static MHD_FN_PAR_NONNULL_ALL_ bool
check_and_alloc_buf_for_upload_processing (struct MHD_Connection *restrict c)
{
mhd_assert ((mhd_ACTION_UPLOAD == c->rq.app_act.head_act.act) || \
(mhd_ACTION_POST_PROCESS == c->rq.app_act.head_act.act));
(mhd_ACTION_POST_PARSE == c->rq.app_act.head_act.act));
if (c->rq.have_chunked_upload)
return true; /* The size is unknown, buffers will be dynamically allocated
@@ -2952,7 +2952,7 @@ mhd_stream_call_app_request_cb (struct MHD_Connection *restrict c)
}
c->state = MHD_CONNECTION_FULL_REQ_RECEIVED;
return true;
case mhd_ACTION_POST_PROCESS:
case mhd_ACTION_POST_PARSE:
mhd_assert (0 && "Not implemented yet");
return true;
case mhd_ACTION_SUSPEND:
@@ -3232,7 +3232,7 @@ process_request_chunked_body (struct MHD_Connection *restrict c)
}
mhd_assert (c->rq.app_aware);
if (mhd_ACTION_POST_PROCESS == c->rq.app_act.head_act.act)
if (mhd_ACTION_POST_PARSE == c->rq.app_act.head_act.act)
{
mhd_assert (0 && "Not implemented yet"); // TODO: implement POST
return false;
@@ -3344,7 +3344,7 @@ process_request_nonchunked_body (struct MHD_Connection *restrict c)
else
cntn_data_ready = c->read_buffer_offset;
if (mhd_ACTION_POST_PROCESS == c->rq.app_act.head_act.act)
if (mhd_ACTION_POST_PARSE == c->rq.app_act.head_act.act)
{
mhd_assert (0 && "Not implemented yet"); // TODO: implement POST
return false;
@@ -3413,10 +3413,10 @@ MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_ bool
mhd_stream_call_app_final_upload_cb (struct MHD_Connection *restrict c)
{
const struct MHD_UploadAction *act;
mhd_assert (mhd_ACTION_POST_PROCESS == c->rq.app_act.head_act.act || \
mhd_assert (mhd_ACTION_POST_PARSE == c->rq.app_act.head_act.act || \
mhd_ACTION_UPLOAD == c->rq.app_act.head_act.act);
if (mhd_ACTION_POST_PROCESS == c->rq.app_act.head_act.act)
if (mhd_ACTION_POST_PARSE == c->rq.app_act.head_act.act)
{
mhd_assert (0 && "Not implemented yet"); // TODO: implement POST
return false;