Stiffstream / restinio

Cross-platform, efficient, customizable, and robust asynchronous HTTP(S)/WebSocket server C++ library with the right balance between performance and ease of use
Other
1.15k stars 93 forks source link

parse_query() does not support unescaped asterisk. #29

Closed rcane closed 5 years ago

rcane commented 5 years ago

It seems that there is an ambiguity as to when an asterisk must be percent-encoded and when it is allowed to be used as-is (see this Stack Overflow question).

We have the problem here that some of our REST requests come from JavaScript's encodeURIComponent which apparently does not escape an asterisk. The problem is that parse_query throws an exception when given a query like this: http://example.com/find?name=A*.

So would you be willing to let parse_query (maybe as an option) accept unescaped asterisks?

eao197 commented 5 years ago

Thank you for reporting this! We'll address this issue as soon as we have some time (we are now quite busy rolling out a new release of another our major product). Sorry for the inconvenience.

eao197 commented 5 years ago

There are updates in the master branch.

Now you can parametrize parse_query call:

restinio::parse_query<restinio::parse_query_traits::javascript_compatible>("name=A*");

Please check it. I hope it should solve your issue.

eao197 commented 5 years ago

restinio::parse_query("name=A*");

This functionality is now a part of RESTinio-0.4.9.1. This version is fixed as tag and available for download from GitHub, BitBucket and Conan (via stiffstream-public).