Fix onprogress not firing when Content-Length is not available for XMLHttpRequest#44899
Fix onprogress not firing when Content-Length is not available for XMLHttpRequest#44899BadLice wants to merge 2 commits into
Conversation
|
Hi @BadLice! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
8084223 to
5507b8b
Compare
Base commit: b8f1b92 |
|
@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@NickGerleman merged this pull request in 457d14b. |
|
This pull request was successfully merged by alicata in 457d14b. When will my fix make it into a release? | How to file a pick request? |
Summary:
When an XMLHttpRequest is performed, the
onprogressevent it is not invoked when theContent-Lengthheader is missing in the response. This is the case when we are calling an endpoint that responds withtransfer-encoding: chunked(https://tools.ietf.org/html/rfc9112#section-7.1), preventing the user to keep track of the progress while the server is sending chunks. Despite we will never know the total length of the content (because it will not be known due to the RFC specification, so it will be always-1), we will now be able to keep track of the loaded data.Note that in Android, this is the current default behaviour.
To address this issue:
downloadProgressBlockwas dispatched only whenresponse.expectedContentLengthwas greater than 0XMLHttpRequestin the tester app to download a chunked fileChangelog:
[IOS] [CHANGED] - fire
onprogressevent forXMLHttpRequesteven when theContent-Lengthheader is missing in the response headersTest Plan: