Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esp_https_ota command ignores http status code 304 (Not Modified) (IDFGH-14016) #14839

Open
3 tasks done
nozols opened this issue Nov 6, 2024 · 2 comments
Open
3 tasks done
Labels
Status: Reviewing Issue is being reviewed

Comments

@nozols
Copy link

nozols commented Nov 6, 2024

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

The esp_https_ota component tries to download the binary when it receives a 304 HTTP status code. I think it should stop the OTA progress, because this status code should indicate that the firmware is already up to date.

According to MDN:

The HTTP 304 Not Modified redirection response status code indicates that there is no need to retransmit the requested resources.

Maybe the same should be done for status code 204, which according to MDN means:

The HTTP 204 No Content successful reponse status code indicates that a request has succeeded, but the client doesn't need to navigate away from its current page.

Returning 404 will stop the OTA in the current esp-idf, but I don't think that is the correct status code to use, as the URL is valid. I would only expect a 404 if the URL doesn't point to a valid location.

Is this something that can be implemented in ESP-IDF?

@espressif-bot espressif-bot added the Status: Opened Issue is new label Nov 6, 2024
@github-actions github-actions bot changed the title esp_https_ota command ignores http status code 304 (Not Modified) esp_https_ota command ignores http status code 304 (Not Modified) (IDFGH-14016) Nov 6, 2024
@nileshkale123
Copy link
Collaborator

Hello @nozols,

We’ve raised a merge request to handle the 304 (NOT_MODIFIED) response code, and it will be merged soon.

Typically, a 204 (NO_CONTENT) response is returned by the server in DELETE or POST requests, so we haven’t included handling for it in the OTA process. However, if you have a specific reproducible case where a 204 response is encountered during OTA, please let us know. We’ll be happy to add support for it if needed.

Thank you!

@nozols
Copy link
Author

nozols commented Nov 11, 2024

Thanks! If status code 304 is supported we don't need 204. Thanks a lot for implementing this.

@espressif-bot espressif-bot added Status: Reviewing Issue is being reviewed and removed Status: Opened Issue is new labels Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Reviewing Issue is being reviewed
Projects
None yet
Development

No branches or pull requests

3 participants