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

httpcaddyfile: Fix panic when parsing route with matchers #3746

Merged
merged 1 commit into from Sep 22, 2020

Conversation

francislavoie
Copy link
Member

@francislavoie francislavoie commented Sep 22, 2020

Fixes #3745

Basically I was doing range segments then modifying segments so we had a couple of bugs going on. Panic if a matcher segment was ever the last thing in a route, and bad parsing (skipped segments) in other situations.

Fixed by using a regular step loop and rewinding one step every time we splice a segment out.

@francislavoie francislavoie added the bug 🐞 Something isn't working label Sep 22, 2020
@francislavoie francislavoie added this to the v2.2.0 milestone Sep 22, 2020
Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

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

Very nice, thanks for the quick and elegant fix, and test case!

@mholt mholt merged commit be6daa5 into caddyserver:master Sep 22, 2020
@francislavoie francislavoie deleted the caddyfile-route-panic branch September 22, 2020 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v2: Can't define more than one named matcher inside of route block in Caddyfile
2 participants