-
-
Notifications
You must be signed in to change notification settings - Fork 174
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
Panic when using -H
with non-https nameserver
#5
Comments
You need to pass a HTTPS-responsible nameserver when using the I know exactly where this is coming from, so don't worry about the short backtrace: this is the panicking line. We need to extract the domain from the URL, and if the nameserver isn't a valid URL, then we can't send the request. In order to get the release out last weekend I hurried and put a The primary fix here is probably to handle the case where the user uses |
I assume you've chosen (Of course, once the software is mature, panics should not really happen anymore, so that might be a good tradeoff.) |
Here, we add an explicit check when the user passes the --https argument without a nameserver. What currently happens is that dog tries to use the system default resolver, which won't be a URL when it should be. This was raised in GH-5. The panic is still there, and it's still simple to trigger, so it's not 100% fixed yet, but at least it's now harder to trigger _accidentally_.
I added a check (the primary fix), so if you don't pass a nameserver, you at least get a warning rather than a crash. |
I thought that
This was built from f756c67. edit: I see in fn split_domain(&self) -> Option<(&str, &str)> {
if let Some(sp) = self.url.strip_prefix("https://") {
if let Some(colon_index) = sp.find('/') {
return Some((&sp[.. colon_index], &sp[colon_index ..]));
}
}
None
} By the way, this code seems to have been copied from if let Some(colon_index) = self.addr.find(':') {
&self.addr[.. colon_index]
} ^ the name Based on this information I did manage to pass the argument in the expected format, and figured out why And it does work fine in this example:
So things seem to work! That said, I think it might be helpful to provide a bit more information in the error message, maybe explain that it needs to start with You could have something like:
I don't know… something like that ¯\_(ツ)_/¯ |
I eventually figured out that the syntax needed to be something like this: $ dog example.org @https://1.1.1.1/dns-query -H I support all of @nicolasff's suggestions and would add that there are two heuristics which could make it extra friendly:
|
I have a standard UDP/TCP-only nameserver setup, trying to pass
-H
to dog results in a panic and abort instead of an error message (there's nothing useful in the backtrace):Using current master:
The text was updated successfully, but these errors were encountered: