Skip to content

Support chunked transfers in wget - #118

Merged
FoamyGuy merged 7 commits into
adafruit:mainfrom
relic-se:chunked-transfer-encoding
Jan 14, 2026
Merged

Support chunked transfers in wget#118
FoamyGuy merged 7 commits into
adafruit:mainfrom
relic-se:chunked-transfer-encoding

Conversation

@relic-se

@relic-se relic-se commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

Chunked transfers are already supported within adafruit_requests but the content-length check within adafruit_portalbase.network.NetworkBase.wget (see below) prevents them from working because they leave that header omitted. (see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Transfer-Encoding#chunked for reference)

if "content-length" in headers:
content_length = int(headers["content-length"])
else:
raise RuntimeError("Content-Length missing from headers")

This update extends wget to allow chunked transfers.

I've provided a simple demonstration using the Adafruit Fruit Jam to download the source files zipball from a GitHub repository which uses chunked transfer encoding.

# Adafruit CircuitPython 10.0.3 on 2025-10-17; Adafruit Fruit Jam with rp2350b
import adafruit_fruitjam
fj = adafruit_fruitjam.FruitJam()
fj.network.connect()
fj.network.wget("https://api.github.com/repos/adafruit/Adafruit_CircuitPython_PortalBase/zipball/3.4.2", "/test.zip")
Connecting to AP ...
Fetching stream from https://api.github.com/repos/adafruit/Adafruit_CircuitPython_PortalBase/zipball/3.4.2
Reply is OK!
Saving data to  /sd/test.zip
...................Created file of 52446 bytes in 0.7 seconds

I've provided more information in my investigation here: relic-se/Fruit_Jam_Library#12.

This update also includes compatibility fixes for adafruit_display_text version 3.4.0 related to outlined labels. (https://github.com/adafruit/Adafruit_CircuitPython_Display_Text/releases/tag/3.4.0)

Comment thread adafruit_portalbase/__init__.py Outdated

@FoamyGuy FoamyGuy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I merged main to this branch and it resolves the outlined label conflict maintaining compatibility.

These changes look good to me. I tested with a Fruit Jam and a local Flask server that has both streaming and non-streaming response endpoints and both seem to work as expected.

@FoamyGuy
FoamyGuy merged commit 067b1b8 into adafruit:main Jan 14, 2026
1 check passed
@relic-se

Copy link
Copy Markdown
Contributor Author

@FoamyGuy Thank you for putting in the effort to test these changes properly. 💯

@relic-se
relic-se deleted the chunked-transfer-encoding branch January 14, 2026 21:08
adafruit-adabot pushed a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants