Skip to content

Commit a2dece8

Browse files
committed
Fix POST processing of final keys without values
'MHD_destroy_post_processor' should be called before the request callback for ensuring the processing of final keys without terminated values.
1 parent acc3e6a commit a2dece8

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/httpserver/details/modded_request.hpp

-3
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ struct modded_request {
6161
modded_request& operator=(modded_request&& b) = default;
6262

6363
~modded_request() {
64-
if (nullptr != pp) {
65-
MHD_destroy_post_processor(pp);
66-
}
6764
if (second) {
6865
delete dhr;
6966
}

src/webserver.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,11 @@ MHD_Result webserver::finalize_answer(MHD_Connection* connection, struct details
662662
if (found) {
663663
try {
664664
if (hrm->is_allowed(method)) {
665+
if (mr->pp != NULL) {
666+
MHD_destroy_post_processor(mr->pp);
667+
mr->pp = NULL;
668+
}
669+
665670
mr->dhrs = ((hrm)->*(mr->callback))(*mr->dhr); // copy in memory (move in case)
666671
if (mr->dhrs.get() == nullptr || mr->dhrs->get_response_code() == -1) {
667672
mr->dhrs = internal_error_page(mr);

0 commit comments

Comments
 (0)