A
A
Alex Franz2019-01-27 18:18:28
Arduino
Alex Franz, 2019-01-27 18:18:28

Problem with HTTP OTA update on ESP32, how should the server respond to a GET request for the contents of a bin file?

Good evening!
I have a WIFI board based on ESP32. I want to implement the function of remote OTA firmware update of the board.
To do this, I found a special library "Update" . Here is an example set up to download the firmware bin file from the AWS Cloud (Amazon).
Instead of Amazon, I want to use my WEB site, for this I uploaded the firmware bin file to the desired directory, which is successfully downloaded from the link. Then I drove it into this example, specified the file name and uploaded it to the ESP32. As a result, I get a message in the debug port: "Client Timeout!". If you look at the code, then this message is displayed if the ESP32 successfully followed the link, made a GET request:

// Get the contents of the bin file
    client.print(String("GET ") + bin + " HTTP/1.1\r\n" +
                 "Host: " + host + "\r\n" +
                 "Cache-Control: no-cache\r\n" +
                 "Connection: close\r\n\r\n");

And then, after a while, I did not receive a response:
unsigned long timeout = millis();
    while (client.available() == 0) {
      if (millis() - timeout > 5000) {
        Serial.println("Client Timeout !");
        client.stop();
        return;
      }
    }

The structure of the response should be as follows:
Response Structure
        HTTP/1.1 200 OK
        x-amz-id-2: NVKxnU1aIQMmpGKhSwpCBh8y2JPbak18QLIfE+OiUDOos+7UftZKjtCFqrwsGOZRN5Zee0jpTd0=
        x-amz-request-id: 2D56B47560B764EC
        Date: Wed, 14 Jun 2017 03:33:59 GMT
        Last-Modified: Fri, 02 Jun 2017 14:50:11 GMT
        ETag: "d2afebbaaebc38cd669ce36727152af9"
        Accept-Ranges: bytes
        Content-Type: application/octet-stream
        Content-Length: 357280
        Server: AmazonS3

        {{BIN FILE CONTENTS}}

The question is, should I do something on the side of the WEB site so that the client can receive such an answer?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
CHolfield, 2019-02-18
@CHolfield

Try to open this url with a browser and download the bin file

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question