[Libevent-users] evhttp_dispatch_callback fix (so '/some?this=that' does not match '/something')

Elliot Foster elliotf-libevent at gratuitous.net
Wed Aug 1 16:36:02 EDT 2007


Another quick fix for the dispatch callback, for when it goes through available callbacks looking for a match.  The problem is that if the request URI has an argument, the comparison is done on the bytes before the url parameter separator.  The result is that the lookup will result in mismatches, especially for a request URI like '/?some_arg=some_val' that will match the first callback found.

Two potential fixes are attached, one that modifies the string to replace the argument separator with a null char before the strcmp, and another that checks for a null char in the potential match (at the same offset as the argument separator.)

Thanks,

Elliot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libevent-1.3c-evhttp_dispatch_callback-ver1.diff
Type: text/x-patch
Size: 529 bytes
Desc: not available
Url : http://monkeymail.org/archives/libevent-users/attachments/20070801/7405f6b8/libevent-1.3c-evhttp_dispatch_callback-ver1.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libevent-1.3c-evhttp_dispatch_callback-ver2.diff
Type: text/x-patch
Size: 783 bytes
Desc: not available
Url : http://monkeymail.org/archives/libevent-users/attachments/20070801/7405f6b8/libevent-1.3c-evhttp_dispatch_callback-ver2.bin


More information about the Libevent-users mailing list