-
Notifications
You must be signed in to change notification settings - Fork 192
fix #292 handle argument keys with multiple values #302
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
Conversation
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.
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.
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.
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.
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.
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.
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.
test/integ/basic.cpp
Outdated
| // Change the content type to trigger "normal" POST processing, | ||
| // otherwise the file processing logic is triggered which does | ||
| // not set the multiple arg values as expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you might have lost me here. Why does this need to be done?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without a different content type the defaults that cURL sets trigger the file processing code, but in this test I am just trying to check the "normal" arg handling with multiple values.
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.
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.
|
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. |
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.
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.
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.
| **/ | ||
| class arg_comparator { | ||
| public: | ||
| using is_transparent = std::true_type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this doing? (I cannot find it used elsewhere)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is required to activate heterogeneous lookup using this comparator. is_transparent just needs to be defined, it doesn't get referenced anywhere. From cppreference:
The member type is_transparent indicates to the caller that this function object is a transparent function object: it accepts arguments of arbitrary types and uses perfect forwarding, which avoids unnecessary copying and conversion when the function object is used in heterogeneous context, or with rvalue arguments. In particular, template functions such as std::set::find and std::set::lower_bound make use of this member type on their Compare types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh cool. I learned something :). Thank you!
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.
|
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. |
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
get_arg()now returns anhttp_arg_valuetype containing a collection of all values associated with the requested key.get_arg_flat()retains the old behavior where just one value is selected and returned.