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() rejects 'valid' query strings #24

Closed rcane closed 5 years ago

rcane commented 5 years ago

Although a query string usually contains key value pairs, it is perfectly legal to have a query like this:

http://example.com/api/foo?1234

This is used for example to implement tracking beacons. The current parse_query() implementation throws an exception given this query. I am not sure how to fix this. parse_query returns a map of key value pairs. So it cannot deal with this in its current form. In my particular use case I would simply like to ignore such queries. So maybe there could be an option for parse_query similar to express_router_t::http_get's option to enable strict parse rules.

Another potential problem with parse_query is that it only accepts & as a separator. But W3C also recommends that servers support semicolon separators.

eao197 commented 5 years ago

Thanks for reporting this! It requires some time to think... I'll take a timeout (hope it'll be short).

eao197 commented 5 years ago

The master branch now contains an updated version. This version:

rcane commented 5 years ago

Thanks for the quick update. This fixes my problem.