Update idf_tools.py (IDFGH-17849)#18750
Open
max-allan wants to merge 1 commit into
Open
Conversation
Collaborator
|
@max-allan Thanks for the contribution. The linked issue hasn't been addressed because in the meantime Honestly, I don't think it would be worth the effort (yours or ours) to make this merge-ready and backport (handle minimum required Python for each release branch - as you can see the pre-commit checks are not passing). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
See issue #14901
The idf_tools.py was using http.client in a way that would fail silently with a short read from the network
Related
Fixes #14901
Testing
Ran the install.sh script where it was previously failing and it didn't fail.
Checklist
Before submitting a Pull Request, please ensure the following:
Note
Medium Risk
Changes the core download path used by
install.shand tool installs; HTTP Range resume depends on server support, though failures surface as explicit errors rather than silent truncation.Overview
Fixes incomplete ESP-IDF tool downloads when the connection drops before the full
Content-Lengthis read—CPython can return an empty read instead of raising, which previously left corrupt partial files.urlretrieve_ctxnow loops up to 8 attempts: after a short read it warns, backs off (capped exponential sleep), and reopens the URL with an HTTPRange: bytes={read}-request, appending to the same output file. Resume requires a 206 response; otherwise it raisesContentTooShortError. File handle lifecycle is wrapped intry/finallyso the destination file is always closed.Adds
urllib.request.Requestfor Range requests and expands the docstring to describe the behavior.Reviewed by Cursor Bugbot for commit abf8a92. Bugbot is set up for automated code reviews on this repo. Configure here.