libevent/libevent — pull request #11 by vskh (2012-05-22 15:59:59+00:00)
Title: Allow wildcards for callback pathes in evhttp.

Proposed patch allows to use '*' in callback pathes (set with evhttp_set_cb()).

For this, I've changed prefix_suffix_match() to report match if pattern ends with
wildcard (i.e. pattern has no suffix after '*').
Also, evhttp_dispatch_callback() if modified to make matching of callback pathes against request uri 'wildcard-aware'. It makes regular traversal through callbacks list searching exact match with strcmp() but while this it also performs match with prefix_suffix_match(). So it behaves now like this:
1. If exact match is found, matching callback is returned
2. If no exact match is found, last added (i.e. with evhttp_set_cb()) callback with matching path is returned.
3. If no pattern match is found, NULL is returned.
As far as prefix_suffix_match() allows, pattern may contain multiple '*' in different places.
Such behavior is useful for me, maybe it gonna be useful for somebody else who's using evhttp.