The Wayback Machine - https://web.archive.org/web/20211019213650/https://github.com/electron-userland/electron-builder/issues/5758
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

Cannot download differentially, fallback to full download: Error: Content-Type "multipart/byteranges" is expected #5758

Open
SinusPi opened this issue Apr 1, 2021 · 9 comments

Comments

@SinusPi
Copy link
Contributor

@SinusPi SinusPi commented Apr 1, 2021

  • Version: 22.3.6
  • Electron Version: 7.1.2
  • Electron Type (current, beta, nightly): current
  • Electron-Updater: 4.2.0

(Not the newest versions, but the code in question hasn't changed since.)

  • Target: Windows

Electron-Updater's multipleRangeDownloader expects a Content-Type: multipart/byteranges; boundary=aaaaaaaaaaaa header when it decides whether the server supports multiple downloads or not. However, if there is just ONE chunk of download, the server would respond with Content-Type: x-something/random and Content-Range: bytes 1111-2222, properly indicating a single-chunk partial - and that's something multipleRangeDownloader doesn't recognize as valid, resulting in a fallback to a full download in a possibly very favorable, small, single-chunk update situation.

Proper behavior would be to check (just in case) if Content-Range is a single chunk, and then allow the partial download.

One could set useMultipleRangeRequest to false to circumvent the problem, but it would negate the benefit of a multipart download in non-single-chunk cases.

I suspect inventing a boundary string and adding a proper byteranges wrapper to incoming data, then feeding it to DataSplitter (multipleRangeDownloader.ts:104), would do the trick, but I don't have the means to build a proper test at the moment.

@mmaietta
Copy link
Collaborator

@mmaietta mmaietta commented Apr 8, 2021

Would you be willing to submit a PR for this?

Easy way to set up your dev environment for local testing with your project: https://github.com/electron-userland/electron-builder/blob/master/CONTRIBUTING.md#to-setup-a-local-dev-environment

@SinusPi
Copy link
Contributor Author

@SinusPi SinusPi commented May 19, 2021

Thanks for the label, but it's not my first issue - I already submitted some improvements to Electron-builder: #4517

@mmaietta
Copy link
Collaborator

@mmaietta mmaietta commented May 19, 2021

Sorry, I was not describing this as a good first issue for you specifically.
I labeled it because I thought it'd be a good first issue for any new person that is looking to contribute 🙂

@SinusPi
Copy link
Contributor Author

@SinusPi SinusPi commented May 23, 2021

For now, I managed to build a workaround - by slightly modifying a "byte-serving PHP script" I found online (it just needs a one-line tweak to always send the multi-range variant, even if just 1 range is requested). Combined with a .htaccess redirect, it transparently serves specific files in a way Electron understands.

@stale
Copy link

@stale stale bot commented Jul 23, 2021

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the backlog label Jul 23, 2021
@SinusPi
Copy link
Contributor Author

@SinusPi SinusPi commented Jul 23, 2021

@stale stale bot removed the backlog label Jul 23, 2021
@mmaietta
Copy link
Collaborator

@mmaietta mmaietta commented Jul 24, 2021

Few notes.

  1. You're encouraged to contribute again to this project

Would you be willing to submit a PR for this?

  1. Backlog items are marked stale; backlog should always be "cleaned". As in, what we work on is based on what we (2 maintainers + the community) are able, or willing, to work on. If an issue has a high impact on many many users, based on comments in a particular Github ticket, then it's more likely we'll get to it. If we'll never get to it, then it's marked stale and will eventually be closed. Closing backlog items represents to the community that the specific ticket will not be worked on.

  2. Maintaining an open-source project is not a job, it's voluntary and contributions are in our free time.

@SinusPi
Copy link
Contributor Author

@SinusPi SinusPi commented Jul 25, 2021

@stale
Copy link

@stale stale bot commented Oct 2, 2021

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the backlog label Oct 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment