Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(router) ensure rebuilds when Routes have 'regex_priority = nil' #4255

Merged
merged 1 commit into from
Jan 29, 2019

Conversation

thibaultcha
Copy link
Member

If Routes have regex_priority properties mixed between numbers and nil
(e.g. one Route was created with a default regex_priority, the other
was created with a purposefully NULL regex_priority, the comparison in
the router rebuild sorting of Routes would error out, because we are
comparing one Route's nil value against another Route's number.

Fix #4254

@@ -110,10 +110,15 @@ do

sort(routes, function(r1, r2)
r1, r2 = r1.route, r2.route
if r1.regex_priority == r2.regex_priority then

local reg_prio1 = r1.regex_priority or 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can regex_priority ever be ngx.null rather than nil?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in the proxy, where we purposefully don't use the opts.nulls option.

@thibaultcha thibaultcha added this to the 1.0.3 milestone Jan 29, 2019
@thibaultcha thibaultcha force-pushed the fix/router-rebuild-no-regex-priority branch from 4f73190 to 6d20106 Compare January 29, 2019 01:07
If Routes have `regex_priority` properties mixed between numbers and nil
(e.g. one Route was created with a default `regex_priority`, the other
was created with a purposefully NULL `regex_priority`, the comparison in
the router rebuild sorting of Routes would error out, because we are
comparing one Route's `nil` value against another Route's `number`.

Fix #4254
@thibaultcha thibaultcha force-pushed the fix/router-rebuild-no-regex-priority branch from 6d20106 to 33e96ac Compare January 29, 2019 01:08
@kikito kikito merged commit f541c5c into master Jan 29, 2019
@kikito kikito deleted the fix/router-rebuild-no-regex-priority branch January 29, 2019 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants