Explorar el Código

Add a timeout to prevent potentially indefinite blocking

master
JustAnotherArchivist hace 2 años
padre
commit
1686e04cbe
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. +2
    -2
      ia-verify-file

+ 2
- 2
ia-verify-file Ver fichero

@@ -17,7 +17,7 @@ if len(item) > 100 or item[0] not in (string.ascii_letters + string.digits) or i
sys.exit(1)

# Fetch https://archive.org/metadata/ITEM to get the two servers that store the item
conn = http.client.HTTPSConnection('archive.org')
conn = http.client.HTTPSConnection('archive.org', timeout = 30)
conn.request('GET', f'/metadata/{item}')
r = conn.getresponse()
if r.status != 200:
@@ -37,7 +37,7 @@ if len(o['workable_servers']) < 2:

# Fetch _files.xml from each server and compare hash
for server in o['workable_servers']:
conn = http.client.HTTPSConnection(server)
conn = http.client.HTTPSConnection(server, timeout = 30)
conn.request('GET', f'{o["dir"]}/{item}_files.xml')
r = conn.getresponse()
if r.status != 200:


Cargando…
Cancelar
Guardar