feat: 新增307跳转支持

Signed-off-by: 502647092 <admin@yumc.pw>
dev
502647092 2016-08-16 12:14:11 +08:00
parent 66c7508009
commit adea1e58e0
1 changed files with 2 additions and 2 deletions

View File

@ -271,8 +271,8 @@ public class DownloadManager {
*/
private URLConnection reload(final CommandSender sender, final URLConnection uc) throws Exception {
final HttpURLConnection huc = (HttpURLConnection) uc;
// 302, 301
if (huc.getResponseCode() == HttpURLConnection.HTTP_MOVED_TEMP || huc.getResponseCode() == HttpURLConnection.HTTP_MOVED_PERM) {
// 302, 301, 307
if (huc.getResponseCode() == HttpURLConnection.HTTP_MOVED_TEMP || huc.getResponseCode() == HttpURLConnection.HTTP_MOVED_PERM || huc.getResponseCode() == 307) {
final String url = huc.getHeaderField("Location");
sender.sendMessage("§6跳转至地址: §3" + url);
return reload(sender, new URL(url).openConnection());