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

Setting to do automatic unescaping on request params and query params #59

Closed seghcder closed 4 years ago

seghcder commented 4 years ago

Suggested feature.

Ie to avoid having to do this for each parameter:

auto thing_param = restinio::utils::unescape_percent_encoding(params["thing"]);
eao197 commented 4 years ago

Thanks for reporting this.

Unfortunately, it's hard to predict when we can address it.

seghcder commented 4 years ago

No problems - understood.

eao197 commented 4 years ago

Hi, @seghcder! I'm trying to address this issue and want to ask for more information about it. Can you describe some use cases where you have to call unescape_percent_encoding manually?

seghcder commented 4 years ago

I just checked two instances where I had issues in the past (param and query) and it seems to be working correctly now. One issue I had was using quote marks in query string like this -

http://api.example.com/api/item/%2221%22/function

I was thinking to have two paths depending if it was a string name or a numeric ID, but needing to handle the edge case where a name is numeric.

At the time it wasn't decoding to "21". But its an edge case, it seems to be working now, and I think there may also have been some issues with the way Postman and/or nginx was processing the url too. I solved it another way in the end but might come back to this topic.

If it comes up again will let you know. Feel free to close.

eao197 commented 4 years ago

If it comes up again will let you know. Feel free to close.

Ok.