On 23/08/11 21:06, Russell Bryant wrote:
On 08/23/2011 01:33 PM, Zane Bitter wrote:
On 23/08/11 17:44, Russell Bryant wrote:
On 08/23/2011 10:26 AM, Zane Bitter wrote:
On 23/08/11 16:20, Russell Bryant wrote:
@@ -174,9 +174,7 @@ int print_help(int code, const char *name, const char *arg, void *userdata) printf("\t-h | --help print this help message.\n"); printf("\t-b | --broker value specify broker host name..\n"); printf("\t-p | --port value specify broker port.\n");
- printf("\t-d | --domain value Specify domain to connect to (Use DNS SRV to determine host).\n"
"\t For this option to take effect, the broker option must not\n"
"\t be provided.\n");
- printf("\t-S | --srv Enable DNS SRV lookup for the specified broker.\n");
Should be "--srv value"
It is currently defined as not taking an argument.
Ah, my bad. I should have read that big comment-y thing at the top.
It seems slightly odd that --broker is sometimes a host and sometimes a domain, but OK.
Not to me... it's similar to how other applications that use SRV work. It usually happens behind the scenes, though. It would be even better to:
1) Determine if the --broker is an IP address and if so, use it. 2) If it's a hostname, first try an SRV lookup. If that fails, fall back to an A/AAAA lookup.
but I don't think it's strictly necessary to implement that.
As a random example of another application that uses SRV records, take Pidgin (the IM client). Let's say you want to add your gmail account as a Jabber/XMPP account. All you have to do is say that your account is <you>@gmail.com. From there, it's going to first try an SRV lookup on gmail.com (which will succeed), and that's how it knows where to connect.
$ dig -t SRV _jabber._tcp.gmail.com
My personal domain, russellbryant.net, is hosted on google apps, so it also supports jabber. However, I don't have the proper SRV record set up, so if I try to set up that as an account in Pidgin the same way, it won't work. It ends up trying to connect to "russellbryant.net", which is not Google's XMPP server. I have to set an additional option that specifies the specific server to connect to, and then it works.
In that case I think you may have a bug, because servername is not set unless the servername itself is resolvable as a hostname:
rc = getaddrinfo(arg, NULL, &hints, &res); if (rc == 0) { (*options)["servername"] = arg; } else { mh_err("Broker '%s' is not resolvable - ignoring", arg); }
If that is a bug, I'll fix it because I'm changing this code anyway.