diff --git a/check_expire b/check_expire index ad51b05..625e9f3 100755 --- a/check_expire +++ b/check_expire @@ -101,7 +101,7 @@ try: elif option == "--hostname" or option == "-H": domain = value elif option == "--timeout" or option == "-t": - timeout = int(value) + timeout = float(value) elif option == "--unixtime" or option == "-u": unixtime = True elif option == "--verbose" or option == "-v": @@ -140,14 +140,16 @@ for server in servers: server = server[:-1] # Donuts RDAP server balks when there are two slashes and reply 404 try: response = requests.get("%s/domain/%s" % (server, domain), timeout=timeout) - if response.status_code != 200: - errors += "Invalid RDAP return code at %s: %s " % \ - (server, response.status_code) - else: - found = True - break except requests.exceptions.Timeout: unknowns += "Timeout when trying to reach %s " % server + continue + if response.status_code != 200: + errors += "Invalid RDAP return code at %s: %s " % \ + (server, response.status_code) + else: + found = True + break +>>>>>>> 3af8b3103483d8f542475b824fce57e28d58e242 if not found: if errors != "": error(errors) diff --git a/tests.yaml b/tests.yaml index 4ea49c1..597b22b 100644 --- a/tests.yaml +++ b/tests.yaml @@ -28,11 +28,11 @@ tests: retcode: 1 partstderr: 'ValueError' - # 2021-07-05: no RDAP server for this TLD + # No RDAP server for this TLD - exe: './check_expire' args: - '-H' - - 'bie.re' + - 'welcome.this-is-not-a-tld' retcode: 3 partstdout: 'No RDAP server' @@ -45,13 +45,13 @@ tests: retcode: 2 partstdout: 'No expiration found' - # Far away and slow, timeout is expected + # With a timeout of 1µs, a timeout is expected - exe: './check_expire' args: - '-t' - - '1' + - '0.000001' - '-H' - - 'nic.ar' + - 'bortzmeyer.org' retcode: 3 partstdout: 'Timeout'