summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2020-08-31 10:01:10 -0700
committerBob Halley <halley@dnspython.org>2020-09-02 07:29:26 -0700
commit97e0a7b9039f18f51fa5813fcf231b6111da319e (patch)
tree8ec4cd9fb3b1b2d234468cd5c12f5e3560353a6d
parent2af6ea36dffc57504319c3b373cb589bb40194e2 (diff)
downloaddnspython-97e0a7b9039f18f51fa5813fcf231b6111da319e.tar.gz
deal with all zero weight URI case
-rw-r--r--dns/rdtypes/util.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/dns/rdtypes/util.py b/dns/rdtypes/util.py
index c2fb603..ddc4c67 100644
--- a/dns/rdtypes/util.py
+++ b/dns/rdtypes/util.py
@@ -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)