Comparison

mod_srvinjection/mod_srvinjection.lua @ 336:e4d5a1d3ff44

mod_srvinjection: Add support for a wildcard host.
author Waqas Hussain <waqas20@gmail.com>
date Wed, 09 Feb 2011 16:35:53 +0500
parent 99:2d03350613c4
child 337:beb5073b866a
comparison
equal deleted inserted replaced
335:8b81257c9dc5 336:e4d5a1d3ff44
24 24
25 local original_lookup = adns.lookup; 25 local original_lookup = adns.lookup;
26 function adns.lookup(handler, qname, qtype, qclass) 26 function adns.lookup(handler, qname, qtype, qclass)
27 if qtype == "SRV" then 27 if qtype == "SRV" then
28 local host = qname:match("^_xmpp%-server%._tcp%.(.*)%.$"); 28 local host = qname:match("^_xmpp%-server%._tcp%.(.*)%.$");
29 local mapping = map[host]; 29 local mapping = map[host] or mapping["*"];
30 if mapping then 30 if mapping then
31 handler(mapping); 31 handler(mapping);
32 return; 32 return;
33 end 33 end
34 elseif qtype == "A" and (qname == "localhost." or qname == "127.0.0.1.") then 34 elseif qtype == "A" and (qname == "localhost." or qname == "127.0.0.1.") then