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

caddyhttp: Improve listen addr error message for IPv6 #4740

Merged
merged 1 commit into from Apr 28, 2022

Conversation

francislavoie
Copy link
Member

Fixes an unclear message as per #4738

Old message:

validate: loading http app module: provision http: srv0: invalid listener address: :0

New message:

validate: loading http app module: provision http: srv0: invalid listener address: ::1:443, there are too many colons, so the port is ambiguous. Did you mean to wrap the IPv6 address with [] brackets?

Part of the issue is we were reusing the same variable before/after parsing, so addr would get clobbered with the empty NetworkAddress value, rendering it as :0. Not useful. I split up the variable name to fix that, and added a condition for when there's too many colons (kinda naive cause it doesn't look at whether [] was already there but whatever) to suggest a fix.

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.

I'm often down for improving error messages. This seems useful, thanks!

@mholt mholt merged commit dcc98da into master Apr 28, 2022
@mholt mholt deleted the ipv6-listen-err-msg branch April 28, 2022 14:18
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.

None yet

2 participants