Skip to content
This repository was archived by the owner on Sep 10, 2024. It is now read-only.
This repository was archived by the owner on Sep 10, 2024. It is now read-only.

OTA.py example: issues when python file contains "\r\n\r\n" #158

@SebastiaanMerckx

Description

@SebastiaanMerckx

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions