Merge branch 'Seb35-pull-request-6'
This commit is contained in:
commit
4e17d48adb
15
check_expire
15
check_expire
@ -101,7 +101,7 @@ try:
|
|||||||
elif option == "--hostname" or option == "-H":
|
elif option == "--hostname" or option == "-H":
|
||||||
domain = value
|
domain = value
|
||||||
elif option == "--timeout" or option == "-t":
|
elif option == "--timeout" or option == "-t":
|
||||||
timeout = int(value)
|
timeout = float(value)
|
||||||
elif option == "--unixtime" or option == "-u":
|
elif option == "--unixtime" or option == "-u":
|
||||||
unixtime = True
|
unixtime = True
|
||||||
elif option == "--verbose" or option == "-v":
|
elif option == "--verbose" or option == "-v":
|
||||||
@ -140,14 +140,15 @@ for server in servers:
|
|||||||
server = server[:-1] # Donuts RDAP server balks when there are two slashes and reply 404
|
server = server[:-1] # Donuts RDAP server balks when there are two slashes and reply 404
|
||||||
try:
|
try:
|
||||||
response = requests.get("%s/domain/%s" % (server, domain), timeout=timeout)
|
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:
|
except requests.exceptions.Timeout:
|
||||||
unknowns += "Timeout when trying to reach %s " % server
|
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
|
||||||
if not found:
|
if not found:
|
||||||
if errors != "":
|
if errors != "":
|
||||||
error(errors)
|
error(errors)
|
||||||
|
26
tests.yaml
26
tests.yaml
@ -28,11 +28,11 @@ tests:
|
|||||||
retcode: 1
|
retcode: 1
|
||||||
partstderr: 'ValueError'
|
partstderr: 'ValueError'
|
||||||
|
|
||||||
# 2021-07-05: no RDAP server for this TLD
|
# No RDAP server for this TLD
|
||||||
- exe: './check_expire'
|
- exe: './check_expire'
|
||||||
args:
|
args:
|
||||||
- '-H'
|
- '-H'
|
||||||
- 'bie.re'
|
- 'welcome.this-is-not-a-tld'
|
||||||
retcode: 3
|
retcode: 3
|
||||||
partstdout: 'No RDAP server'
|
partstdout: 'No RDAP server'
|
||||||
|
|
||||||
@ -45,13 +45,13 @@ tests:
|
|||||||
retcode: 2
|
retcode: 2
|
||||||
partstdout: 'No expiration found'
|
partstdout: 'No expiration found'
|
||||||
|
|
||||||
# Far away and slow, timeout is expected
|
# With a timeout of 1µs, a timeout is expected
|
||||||
- exe: './check_expire'
|
- exe: './check_expire'
|
||||||
args:
|
args:
|
||||||
- '-t'
|
- '-t'
|
||||||
- '1'
|
- '0.000001'
|
||||||
- '-H'
|
- '-H'
|
||||||
- 'nic.ar'
|
- 'bortzmeyer.org'
|
||||||
retcode: 3
|
retcode: 3
|
||||||
partstdout: 'Timeout'
|
partstdout: 'Timeout'
|
||||||
|
|
||||||
@ -143,14 +143,14 @@ tests:
|
|||||||
retcode: 0
|
retcode: 0
|
||||||
stderr: ''
|
stderr: ''
|
||||||
|
|
||||||
# Iran, expiration date in the past
|
# Iran, expiration date in the past. But down (2024-06-16)
|
||||||
- exe: './check_expire'
|
#- exe: './check_expire'
|
||||||
args:
|
# args:
|
||||||
- '-H'
|
# - '-H'
|
||||||
- 'nic.pars'
|
# - 'nic.pars'
|
||||||
retcode: 2
|
# retcode: 2
|
||||||
partstdout: "already expired"
|
# partstdout: "already expired"
|
||||||
stderr: ''
|
# stderr: ''
|
||||||
|
|
||||||
# Brazil
|
# Brazil
|
||||||
- exe: './check_expire'
|
- exe: './check_expire'
|
||||||
|
Loading…
Reference in New Issue
Block a user