breautek commented on issue #328:
URL: 
https://github.com/apache/cordova-plugin-file-transfer/issues/328#issuecomment-2086130915

   Not all download requests signals the client how many bytes there are.
   
   Generally speaking the server must send a `Content-Length` response header 
for progress events to have a computable length. For large files, it's fairly 
common practice to use [Chunked Transfer 
Encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding)
 instead in which case the response will not have a `Content-Length`. Services 
that uses Chunked Transfer Encoding generally use it because the service itself 
doesn't know how large the asset is.
   
   In the case of electron/browser platform, the underlying implementation is 
the browser XMLHttpRequest API itself, and `lengthComputable` may have other 
requirements for it to become true. The standard just specifies when it should 
be true, but doesn't necessary dictate how, and it might be up for 
interpretation.
   
   For iOS/Android platform, Cordova looks for the `Content-Length` response 
header.
   
   It's up to the application to check the `lengthComputable` field before 
attempting to calculate the transfer rate or progress. Because the data might 
not be provided by the server that you're making the download request from.
   
   I don't believe this is a bug but I won't close this issue just yet. If 
someone can demonstrate this issue occurring on android/ios on a download 
request in which provides a `Content-Length` response header, then I think this 
warrants investigating further. Otherwise I don't think this a bug.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to