> why don't you just use the "new fetch" api
IFIR when the original version of that code was written (back in the Oryol project
https://github.com/floooh/oryol), the Fetch API might not have been implemented by all browsers yet. It probably makes sense to rewrite sokol_fetch.h to use Fetch now).
> in this case ,the content-length was unknown, so the range request is not possible, right
I don't know, I hadn't considered this case. Probably needs some experimenting.
The most annoying problem with XMLHttpRequest is definitely that it's not possible to query the uncompressed size of compressed downloads upfront, so it's not possible to first do a HEAD request to get the Content-Length, and allocate a buffer of the right size to receive the download, because Content-Length will be the compressed size, but the downloaded data will be uncompressed. Same with Range requests, the offset and size is provided on the compressed data, so the data chunk that's returned will be bigger then the requested size. TBH I have no idea in which scenario such a weird behaviour would ever make sense, but there are not many things in web development that make sense anyway ;)
I'll actually need to look into the Fetch API if this somehow fixes the compressed vs uncompressed offset/size problem (I would be surprised if it did though).
Cheers!
-Floh.