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

Elliot Foster elliotf-libevent at gratuitous.net
Thu Aug 2 15:52:20 EDT 2007


Here's a follow-up with a regression test (attached.)

Elliot

Elliot Foster wrote:
> 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
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Libevent-users mailing list
> Libevent-users at monkey.org
> http://monkey.org/mailman/listinfo/libevent-users


-------------- next part --------------
A non-text attachment was scrubbed...
Name: libevent-1.3c-dispatch_callback-regression_test.diff
Type: text/x-patch
Size: 3019 bytes
Desc: not available
Url : http://monkeymail.org/archives/libevent-users/attachments/20070802/cdbfec72/libevent-1.3c-dispatch_callback-regression_test.bin


More information about the Libevent-users mailing list