]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
deal with all zero weight URI case
authorBob Halley <halley@dnspython.org>
Mon, 31 Aug 2020 17:01:10 +0000 (10:01 -0700)
committerBob Halley <halley@dnspython.org>
Wed, 2 Sep 2020 14:29:26 +0000 (07:29 -0700)
dns/rdtypes/util.py

index c2fb6038256f5634dde084d1aa3a2dacf782126e..ddc4c6722015bc65179b05546e84a4b2fd7c3129 100644 (file)
@@ -240,6 +240,11 @@ def weighted_processing_order(iterable, adjust_zero_weight=False):
                 weight = _processing_weight(rdata, adjust_zero_weight)
                 weights.remove(weight)
             ordered.append(rdatas[0])
+        elif weights[0] == 0:
+            # All the weights are 0!  (This can't happen with SRV, but
+            # can with URI.  It's not clear from the URI RFC what you do here
+            # as it doesn't discuss weight.
+            return []
         else:
             random.shuffle(rdatas)
             ordered.extend(rdatas)