读取超时后重新读取ResponseStream

发布于 2024-08-10 14:07:05 字数 72 浏览 3 评论 0原文

我想知道当我读取响应流并发生超时时,我可以重试读取吗?或者我必须提出新的要求吗?我正在下载的服务器不支持恢复,因此我需要防止超时。

I am wondering when I read a response stream and a timeout occurs, can I retry the read? Or do I have to make a new request? The server that I am downloading from does not support resuming, so I need to protect against timeouts.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

落花浅忆 2024-08-17 14:07:05

不,你不能重试。您需要重新发出请求

No, you can't retry. You need to reissue the request

素年丶 2024-08-17 14:07:05

你怎么知道服务器不接受简历?是 Accept-Ranges 响应中确实缺少标头?如果没有,您可以使用 Range 恢复请求 标头。

如果服务器确实不支持它,那么您可以尝试的最好方法是使用 Connection: keep-alive 标头结合 保持活动< /code>标头,您可以在其中指定超时。

希望这有帮助。

How do you know that the server doesn't accept resumes? Is the Accept-Ranges header indeed lacking in the response? If not, you could resume the request using the Range header.

If the server indeed doesn't support it, then best what you can try is to inform the server that you want to keep the connection alive using Connection: keep-alive header in combination with the Keep-Alive header wherein you can specify the timeout.

Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文