# HG changeset patch # User Sergey Kandaurov # Date 1385032810 -14400 # Node ID 7a472e46772c32c75450aa8e0b44a88f0eb57db4 # Parent 14eba1ad08800e936ef5bd1c376613dbde25bfca Tests: added http resolver test for CNAME + A combined answer. diff --git a/http_resolver.t b/http_resolver.t --- a/http_resolver.t +++ b/http_resolver.t @@ -101,7 +101,7 @@ plan(skip_all => 'no inet6 support') if $t->waitforsocket('127.0.0.1:8081'); $t->waitforsocket('127.0.0.1:8082'); -$t->plan(27); +$t->plan(28); ############################################################################### @@ -121,6 +121,11 @@ like(http_host_header('cname.example.net like(http_host_header('cname.example.net', '/cached'), qr/200 OK/, 'CNAME cached'); +# CNAME + A combined answer +# demonstrates the name in answer section different from what is asked + +like(http_host_header('cname_a.example.net', '/'), qr/200 OK/, 'CNAME + A'); + # CNAME refers to non-existing A like(http_host_header('cname2.example.net', '/'), qr/502 Bad/, 'CNAME bad'); @@ -169,7 +174,6 @@ sleep 2; # expired ttl causes nginx to query the next (bad) ns -skip: like(http_host_header('ttl.example.net', '/two'), qr/502 Bad/, 'ttl expired'); # zero ttl prohibits response caching @@ -269,6 +273,13 @@ sub reply_handler { ($type, $rdata) = ('CNAME', 'alias.example.net'); push @ans, Net::DNS::RR->new("$name $ttl $class $type $rdata"); + } elsif ($name eq 'cname_a.example.net') { + ($type, $rdata) = ('CNAME', 'alias.example.net'); + push @ans, Net::DNS::RR->new("$name $ttl $class $type $rdata"); + + ($name, $type, $rdata) = ('alias.example.net', 'A', '127.0.0.1'); + push @ans, Net::DNS::RR->new("$name $ttl $class $type $rdata"); + } elsif ($name eq 'cname2.example.net') { # points to non-existing A ($type, $rdata) = ('CNAME', 'nx.example.net');