I observed while testing OTA upgrade (using lib OTA.py), that the hash for a specific file was always incorrectly calculated by the OTA.py.
In fact, the issue is that the stripping of HTML header in "get_data()" function does not properly work if the "result" contains more than 1 "\r\n\r\n".
result = result.decode().split("\r\n\r\n")[1].encode()
To be replaced with something like:
index = result.decode().find("\r\n\r\n")
result = result[index+4:]
This issue can be reproduced by running the OTA server and making sure that a file containing "\r\n\r\n" (2 empty lines on top, or 1 empty line between 2 statements) needs to be downloaded and hash-verified.
Issue:
I observed while testing OTA upgrade (using lib OTA.py), that the hash for a specific file was always incorrectly calculated by the OTA.py.
In fact, the issue is that the stripping of HTML header in "get_data()" function does not properly work if the "result" contains more than 1 "\r\n\r\n".
result = result.decode().split("\r\n\r\n")[1].encode()
To be replaced with something like:
This issue can be reproduced by running the OTA server and making sure that a file containing "\r\n\r\n" (2 empty lines on top, or 1 empty line between 2 statements) needs to be downloaded and hash-verified.