mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-11-26 15:17:00 +00:00
fix(parser): 处理小飞机下载错误响应解码异常
捕获不支持的编码及响应体超限异常,明确结束解析请求,补充回归测试。
This commit is contained in:
2 files changed
+34
-1
No files matched your search
@@ -443,7 +443,14 @@ public class FjTool extends PanBase {
|
||||
private void down(HttpResponse<Buffer> res2) {
|
||||
MultiMap headers = res2.headers();
|
||||
if (StringUtils.isBlank(headers.get("Location"))) {
|
||||
fail("{}", FjDownloadParams.missingLocation(res2.statusCode(), asText(res2)));
|
||||
String body;
|
||||
try {
|
||||
body = asText(res2);
|
||||
} catch (IllegalArgumentException | UnsupportedOperationException e) {
|
||||
fail(e, "读取下载错误响应失败, HTTP {}", res2.statusCode());
|
||||
return;
|
||||
}
|
||||
fail("{}", FjDownloadParams.missingLocation(res2.statusCode(), body));
|
||||
return;
|
||||
}
|
||||
promise.complete(headers.get("Location"));
|
||||
|
||||
Reference in new issue
Block a user