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

reverseproxy: do not parse upstream address too early if it contains replaceble parts #5695

Merged
merged 4 commits into from
Aug 5, 2023

Conversation

mohammed90
Copy link
Member

Fixes #5688

@mohammed90 mohammed90 added this to the v2.7.4 milestone Aug 5, 2023
Copy link
Member

@francislavoie francislavoie left a comment

Choose a reason for hiding this comment

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

I like the struct refactor! Certainly reads cleaner this way.

modules/caddyhttp/reverseproxy/addresses_test.go Outdated Show resolved Hide resolved
modules/caddyhttp/reverseproxy/addresses_test.go Outdated Show resolved Hide resolved
@francislavoie francislavoie added the bug 🐞 Something isn't working label Aug 5, 2023
@francislavoie
Copy link
Member

francislavoie commented Aug 5, 2023

Do we have coverage for when the host or entire thing is a placeholder? I think we probably also want a test for when the port has a numerical prefix followed by a placeholder (as in the reported issue).

I think we can just put a lot of reverse_proxy lines in the adapt fixture with different edgecases. And maybe add some more in https://github.com/caddyserver/caddy/blob/master/modules/caddyhttp/reverseproxy/addresses_test.go

I think this looks good to me 👍

@mohammed90
Copy link
Member Author

mohammed90 commented Aug 5, 2023

I think we probably also want a test for when the port has a numerical prefix followed by a placeholder (as in the reported issue)

I missed that and screwed it up in my second refactor 🤦🏼‍♂️

Do we have coverage for when the host or entire thing is a placeholder?

Added

Copy link
Member

@francislavoie francislavoie left a comment

Choose a reason for hiding this comment

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

LGTM but let's hear from Matt too ☺️

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.

Ah wow, yeah this refactor is way better. And the new tests, love it.

Thank you for fixing this Mohammed 💯

@mohammed90 mohammed90 merged commit 65e33fc into master Aug 5, 2023
19 checks passed
@mohammed90 mohammed90 deleted the issue-5688 branch August 5, 2023 21:30
@mholt mholt modified the milestones: v2.7.4, v2.7.3 Aug 6, 2023
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.

reverse_proxy upstream directive interprolation throwing strconv.ParseUint
3 participants