1
1
mirror of https://github.com/eblot/pybootd.git synced 2024-08-17 18:00:33 +03:00

Add a trace and fix remote file size

This commit is contained in:
Emmanuel Blot 2020-04-12 18:38:17 +02:00
parent d284d5bfce
commit 40abb45ddd

View File

@ -419,11 +419,13 @@ class BootpServer:
url = joinpath(path, bootp_buf[BOOTP_FILE].decode())
try:
resource = urlopen(url)
int(resource.info()['Content-Length'])
bootfile_size = int(resource.info()['Content-Length'])
except Exception as exc:
self.log.error('Cannot retrieve size of %s: %s',
url, exc)
if bootfile_size:
self.log.debug('Bootfile %s is %d byte long',
bootfile_name, bootfile_size)
bootfile_block = (bootfile_size+511)//512
buf += spack('!BBH', 13, scalc('!H'), bootfile_block)
if 60 in client_params: