Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #268: Fix POST processing of final keys without values #269

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JavierJF
Copy link

@JavierJF JavierJF commented May 13, 2022

Identify the Bug

#268

Description of the Change

The change is simple, instead of calling 'MHD_destroy_post_processor' in the destructor after the request has been processed, it's called before calling the registered processing callback.

Alternate Designs

I haven't think in alternate designs. I chose to call 'MHD_destroy_post_processor' right before mr->callback because I think it's the only place requiring of the final post processing of the request. Thus, keeping the two operation close makes sense.

Possible Drawbacks

If all the information is going to be used just by mr->callback, can't think of any drawback.

Verification Process

Sorry, internal testing, just testing over the endpoints in a third party application.

Release Notes

  • Fixed processing of final keys without values for POST body processing of kind 'application/x-www-form-urlencoded'

'MHD_destroy_post_processor' should be called before the request
callback for ensuring the processing of final keys without terminated
values.
@@ -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) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we use nullptr instead of NULL

Copy link
Owner

@etr etr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. Looks good overall - I left you a nitpicky comment about NULL vs nullptr.

I think the only missing thing is a test proving the use-case you spotted and the fact that it now works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants