From 14c77c39d26a416ace11fbee7920e7c0d8d16b34 Mon Sep 17 00:00:00 2001 From: Asumu Takikawa Date: Fri, 1 Mar 2013 00:48:11 -0500 Subject: [PATCH] Fix net/dns contracts --- collects/net/dns.rkt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/collects/net/dns.rkt b/collects/net/dns.rkt index 74728cce59..65fe9bdd98 100644 --- a/collects/net/dns.rkt +++ b/collects/net/dns.rkt @@ -35,12 +35,17 @@ val)]) (and matches (= (length matches) 5) + ;; check that each octet field is an octet + (andmap byte? (map string->number (cdr matches))) + ;; leading zeroes lead to query errors (not (ormap has-leading-zeroes? matches)))))) (module+ test (check-true (ip-address-string? "8.8.8.8")) - (check-true (ip-address-string? "80.8.800.8")) - (check-true (ip-address-string? "80.8.800.0")) + (check-true (ip-address-string? "12.81.255.109")) + (check-true (ip-address-string? "192.168.0.1")) + (check-false (ip-address-string? "80.8.800.8")) + (check-false (ip-address-string? "80.8.800.0")) (check-false (ip-address-string? "080.8.800.8")) (check-false (ip-address-string? "vas8.8.800.8")) (check-false (ip-address-string? "80.8.128.8dd"))