getUrlConnection获取inputStream报416错误
wu964362048 opened this issue · comments
wu964362048 commented
public static HttpURLConnection getHttpUrlConnection(String url, long start, Long end) throws IOException {
HttpURLConnection httpUrlConnection = getHttpUrlConnection(url);
if (end != null) {
httpUrlConnection.setRequestProperty("RANGE", "bytes=" + start + "-" + end);
} else {
httpUrlConnection.setRequestProperty("RANGE", "bytes=" + start + "-");
}
return httpUrlConnection;
}
该方法中的有end范围增加 ”/*“之后会发生错误,在获取inputStream的时候会报416错误,在qq/微信的下载链接中均会报错
程序猿阿朗 commented
确实有这个问题,现在版本已经去掉末尾的 /* 了,当初加这个 /* 也是阅读了 HTTP 请求头的规范写进去的,后来发现某些网站不支持,像你说的会报错,还有些会让 Range 参数失效,原因还不清楚。