Tests: added http resolver test for CNAME + A combined answer.
diff --git a/http_resolver.t b/http_resolver.t index 786c254..6344147 100644 --- a/http_resolver.t +++ b/http_resolver.t
@@ -101,7 +101,7 @@ $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', '/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 @@ # 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 @@ ($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');