ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AnyEvent/DNS.pm
(Generate patch)

Comparing AnyEvent/lib/AnyEvent/DNS.pm (file contents):
Revision 1.92 by root, Sun Jun 7 16:48:38 2009 UTC vs.
Revision 1.93 by root, Mon Jun 22 11:57:05 2009 UTC

295C<$ENV{PERL_ANYEVENT_EDNS0}>, but when set to C<1>, AnyEvent::DNS will use 295C<$ENV{PERL_ANYEVENT_EDNS0}>, but when set to C<1>, AnyEvent::DNS will use
296EDNS0 in all requests. 296EDNS0 in all requests.
297 297
298=cut 298=cut
299 299
300our $EDNS0 = $ENV{PERL_ANYEVENT_EDNS0} * 1; # set to 1 to enable (partial) edns0 300our $EDNS0 = $ENV{PERL_ANYEVENT_EDNS0}*1; # set to 1 to enable (partial) edns0
301 301
302our %opcode_id = ( 302our %opcode_id = (
303 query => 0, 303 query => 0,
304 iquery => 1, 304 iquery => 1,
305 status => 2, 305 status => 2,
655 655
656our $RESOLVER; 656our $RESOLVER;
657 657
658sub resolver() { 658sub resolver() {
659 $RESOLVER || do { 659 $RESOLVER || do {
660 $RESOLVER = new AnyEvent::DNS; 660 $RESOLVER = new AnyEvent::DNS untaint => 1;
661 $RESOLVER->os_config; 661 $RESOLVER->os_config;
662 $RESOLVER 662 $RESOLVER
663 } 663 }
664} 664}
665 665
703=item reuse => $seconds 703=item reuse => $seconds
704 704
705The number of seconds (default: C<300>) that a query id cannot be re-used 705The number of seconds (default: C<300>) that a query id cannot be re-used
706after a timeout. If there was no time-out then query ids can be reused 706after a timeout. If there was no time-out then query ids can be reused
707immediately. 707immediately.
708
709=item untaint => $boolean
710
711When true, then the resolver will automatically untaint results, and might
712also ignore certain environment variables.
708 713
709=back 714=back
710 715
711=cut 716=cut
712 717
822 $self->_compile; 827 $self->_compile;
823} 828}
824 829
825=item $resolver->os_config 830=item $resolver->os_config
826 831
827Tries so load and parse F</etc/resolv.conf> on portable operating systems. Tries various 832Tries so load and parse F</etc/resolv.conf> on portable operating
828egregious hacks on windows to force the DNS servers and searchlist out of the system. 833systems. Tries various egregious hacks on windows to force the DNS servers
834and searchlist out of the system.
829 835
830=cut 836=cut
831 837
832sub os_config { 838sub os_config {
833 my ($self) = @_; 839 my ($self) = @_;
939} 945}
940 946
941sub _feed { 947sub _feed {
942 my ($self, $res) = @_; 948 my ($self, $res) = @_;
943 949
950 ($res) = $res =~ /^(.*)$/s
951 if AnyEvent::TAINT && $self->{untaint};
952
944 $res = dns_unpack $res 953 $res = dns_unpack $res
945 or return; 954 or return;
946 955
947 my $id = $self->{id}{$res->{id}}; 956 my $id = $self->{id}{$res->{id}};
948 957

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines