From 24abb667fea679ca40c56d48f8947c14bc579bc2 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 3 Oct 2010 03:49:10 -0500 Subject: [PATCH] Special-case "localhost" in dns queries --- extra/dns/dns.factor | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/extra/dns/dns.factor b/extra/dns/dns.factor index 84a9b6d50d..0d85021cb4 100644 --- a/extra/dns/dns.factor +++ b/extra/dns/dns.factor @@ -8,7 +8,7 @@ io.files io.ports io.sockets io.sockets.private io.streams.byte-array io.timeouts kernel make math math.bitwise math.parser math.ranges math.statistics memoize namespaces nested-comments random sequences slots.syntax splitting strings -system unicode.categories vectors vocabs.loader ; +system unicode.categories vectors vocabs.loader unicode.case ; IN: dns GENERIC: stream-peek1 ( stream -- byte/f ) @@ -400,7 +400,15 @@ M: SOA rdata>byte-array [ dns-AAAA-query a-message. ] [ dns-MX-query mx-message. ] tri ; -! M: string resolve-host dns-A-query message>a-names [ ] map ; +USE: nested-comments +(* +M: string resolve-host + dup >lower "localhost" = [ + drop resolve-localhost + ] [ + dns-A-query message>a-names [ ] map + ] if ; +*) HOOK: initial-dns-servers os ( -- seq )