Skip to content

ESP8226HTTPUpdate #1250

Closed
Closed
@adrian-dybwad

Description

@adrian-dybwad

After having some updates corrupted when the server returned an unexpected response on a server error, I made some changes to the update function in ESP8226HTTPUpdate.cpp so the error response was not written to the ESP and treated like an update.

I added a boolean parameter to the handleUpdate function in ESP8266HTTPUpdate called "requireMD5" with a default value of false.
Then, in the handleUpdate function inside ESP8266HTTPUpdate.cpp itself,

    if(http->hasHeader("x-MD5")) {
        DEBUG_HTTP_UPDATE("[httpUpdate]  - MD5: %s\n", http->header("x-MD5").c_str());
    } else if (code == 200 && requireMD5) {
        DEBUG_HTTP_UPDATE("[httpUpdate]  - MD5 not found, aborting...\n");
        http->end();
        return HTTP_UPDATE_FAILED;
    }

You may consider adding something like this to the main code base!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions