Hello everyone,
We have a question regarding the partial content download of a VTPK file. The file is stored in our ArcGIS Enterprise environment — it’s not a hosted tile layer (vector tile service), but a regular VTPK file that can be downloaded directly.
We are using a URLSessionDownloadTask to handle the download. However, when we start and then pause the download, resuming it later causes the download to start from the beginning instead of continuing from where it left off.
To verify our implementation, we tested another example file — https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4 — and partial downloads work correctly there, so the issue doesn’t appear to be related to our code.
The URL we use to access the VTPK file is:
https://<portalURL>/portal/sharing/rest/content/items/<id>/data?token=<token>
We also tested with curl to check if the portal supports partial content requests, and we received an HTTP/2 206 response. So partial content loading is supported, but it doesn’t seem to work as expected in our case.
Are we missing something, or can you tell us if this functionality is generally expected to work?
Thanks!
Marvin
Apologies for the late response. I don't have an Enterprise test server at hand, so I tested with ArcGIS Online with this style file (used this data link for download).
The partial download for both your example file sample-mp4-file.mp4, and this style file can be paused and resumed correctly. Can you verify the AGOL item works for you?
If so, I'll try to find some Enterprise data to test and back to you…
No problem, and thanks for your reply! 🙂
I tested with your file, and it's working like a charm. So it seems to be an issue with our ArcGIS Enterprise instance. Maybe you can find an Enterprise instance or some data to test it against.
Short answer: Enterprise doesn't support partial-download-and-resume for iOS, even partial download is supported for other platforms.
---
Long answer: It should, and I hope we can make it happen together.
URLSessionDownloadTask.cancelByProducingResumeData() specifies that in order to support partial download…
The task is an HTTP or HTTPS GET request
The server provides either the ETag or Last-Modified header (or both) in its response
The server supports byte-range requests, i.e., Accept-Ranges: bytes
According to my test, when I make a GET request to AGOL data, its response header has all 3 required fields: ETag, Last-Modified, and Accept-Ranges. While Enterprise only has ETag, and missing the critical Accept-Ranges field that allows the download task to partially download.
Please confirm if you see this response header Accept-Ranges difference on your Enterprise server vs AGOL as well.
I had a chat with an Enterprise colleague and he said that by making a HEAD request (instead of GET), an Enterprise server would give the Accept-Ranges field in the response header. That might make sense for other platforms, but doesn't suit Apple's URLSessionDownloadTask 's need, as the download task only makes a GET request.
At this point, I would suggest:
Feel free to loop me in if you decide to go with the first 2 options. I would like to see Enterprise better support Apple's APIs.
Thanks for the detailed feedback.
It’s really a shame that ArcGIS Enterprise doesn’t support partial downloading for iOS. But yes, I can confirm that for ArcGIS Enterprise, the GET request response is missing the "Accept-Ranges: bytes" header — only "etag" is present. For ArcGIS Online, however, "Accept-Ranges: bytes" is available.
We’ll probably go with the first two options. I think it’s not only a small change to implement support for partial downloads, but since it’s an important feature — especially for mobile devices where internet connections can be unstable — it would definitely be worth implementing in ArcGIS Enterprise for the future.