-
Notifications
You must be signed in to change notification settings - Fork 160
match wrong callback when set two same path #129
Comments
It also searches in an ordered manner; have you tried putting the longest match first? |
|
I see. Any auto-sort would only apply to static URI's, I cannot sort based on regex or globs for obvious reasons. Is that OK? |
Added a compile-time flag -DEVHTP_SORT_CALLBACKS which will auto-sort globs and non-regex callbacks to search from longest to shortest. This is optional since we do not want to potentially mess up any code currently running in production that does this sort of thing manually (ie ordering code).
Hello @lwzcwh, I pushed up a test branch for you here: https://github.com/criticalstack/libevhtp/tree/issue129 (diff here: https://github.com/criticalstack/libevhtp/compare/issue129) I am leaving this as an optional compile-time flag, you must run
..along with any other options you would like. Since I do not want to affect any other code, this is not enabled by default. If this looks OK to you, I will merge. |
https://github.com/criticalstack/libevhtp/blob/0f52e868d88391d0f61d180c136404da3079efd9/evhtp.c#L906
when we set two path using evhtp_set_cb like below,it will math wrong cb:
path1: /abc/0 cb1
path2:/abc/012 cb2
when we call the rest server using path /abc/012 ,it will call cb1
The text was updated successfully, but these errors were encountered: