etr / libhttpserver

C++ library for creating an embedded Rest HTTP server (and more)
GNU Lesser General Public License v2.1
893 stars 186 forks source link

fix #292 handle argument keys with multiple values #302

Closed stuart-byma closed 1 year ago

stuart-byma commented 1 year ago

Identify the Bug

292

Description of the Change

This change allows the server to handle argument keys with multiple values e.g. url?arg=param&arg=what

Previous, the arg key would just be overwritten with the next value. This change adds a http_arg_value type to house all the values for a given key.

Adjust existing get_arg(s) methods, and add some get_arg_flat type methods that still just return the first value for a given key.

Add a test case for multiple valued keys.

Add a test case for a large file upload that triggers chunking behavior of MHD. This causes the server to concatenate file chunks within the first value of the given arg key, so the test ensures that this behavior is not affected by the changes.

Alternate Designs

Design is according to discussion in #292

Possible Drawbacks

Small changes to public API.

Verification Process

Additional testing added as in change description. In particular, verify that large file handling behavior has not regressed.

Release Notes

stuart-byma commented 1 year ago

Some auto checks were cancelled? Never seen that before!

etr commented 1 year ago

Some auto checks were cancelled? Never seen that before!

I suspect that github has finally deprecated ubuntu 18.04 - I've started noticing this issue elsewhere as well. I think we can ignore that check for the purpose of this PR.

etr commented 1 year ago

Thanks for the change and for the patience to go through the review process. I think this is a great feature to have in the library.