Skip to content

Commit

Permalink
Fix POST processing of final keys without values
Browse files Browse the repository at this point in the history
'MHD_destroy_post_processor' should be called before the request
callback for ensuring the processing of final keys without terminated
values.
  • Loading branch information
JavierJF committed May 13, 2022
1 parent acc3e6a commit c2f6d28
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/webserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,11 @@ MHD_Result webserver::finalize_answer(MHD_Connection* connection, struct details
if (found) {
try {
if (hrm->is_allowed(method)) {
if (mr->pp != NULL) {
MHD_destroy_post_processor(mr->pp);
mr->pp = NULL;
}

mr->dhrs = ((hrm)->*(mr->callback))(*mr->dhr); // copy in memory (move in case)
if (mr->dhrs.get() == nullptr || mr->dhrs->get_response_code() == -1) {
mr->dhrs = internal_error_page(mr);
Expand Down

0 comments on commit c2f6d28

Please sign in to comment.