Implement pause/resume in file downloading

后端 未结 5 1198
小鲜肉
小鲜肉 2020-12-02 08:12

I\'m trying to implement pause/resume in my download manager, I search the web and read several articles and change my code according them but resume seems not working corre

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-02 08:55

    It is impossible to tell what is wrong without some more information, however things to note:

    1. You must make a HTTP/1.1 request (it's hard to tell from your sample code)
    2. The server must support HTTP/1.1
    3. The server will tell you what it supports with an Accept-Ranges header in the response
    4. If-Range should be the etag the server gave you for the resource, not the last modified time

    You should check your range request with something simple to test the origin actually supports the Range request first (like curl or wget )

提交回复
热议问题