|
|
@ -16,6 +16,7 @@ |
|
|
|
package com.arialyy.aria.core.download.downloader; |
|
|
|
package com.arialyy.aria.core.download.downloader; |
|
|
|
|
|
|
|
|
|
|
|
import android.net.TrafficStats; |
|
|
|
import android.net.TrafficStats; |
|
|
|
|
|
|
|
import android.net.Uri; |
|
|
|
import android.os.Process; |
|
|
|
import android.os.Process; |
|
|
|
import android.text.TextUtils; |
|
|
|
import android.text.TextUtils; |
|
|
|
import com.arialyy.aria.core.AriaManager; |
|
|
|
import com.arialyy.aria.core.AriaManager; |
|
|
@ -284,13 +285,17 @@ public class HttpFileInfoThread implements Runnable { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void handleUrlReTurn(HttpURLConnection conn, String newUrl) throws IOException { |
|
|
|
private void handleUrlReTurn(HttpURLConnection conn, String newUrl) throws IOException { |
|
|
|
ALog.d(TAG, "30x跳转,新url为【" + newUrl + "】"); |
|
|
|
ALog.d(TAG, "30x跳转,新url为【" + newUrl + "】"); |
|
|
|
if (TextUtils.isEmpty(newUrl) || newUrl.equalsIgnoreCase("null") || !newUrl.startsWith( |
|
|
|
if (TextUtils.isEmpty(newUrl) || newUrl.equalsIgnoreCase("null")) { |
|
|
|
"http")) { |
|
|
|
|
|
|
|
if (onFileInfoCallback != null) { |
|
|
|
if (onFileInfoCallback != null) { |
|
|
|
onFileInfoCallback.onFail(mEntity, new TaskException(TAG, "获取重定向链接失败"), false); |
|
|
|
onFileInfoCallback.onFail(mEntity, new TaskException(TAG, "获取重定向链接失败"), false); |
|
|
|
} |
|
|
|
} |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (newUrl.startsWith("/")) { |
|
|
|
|
|
|
|
Uri uri = Uri.parse(mEntity.getUrl()); |
|
|
|
|
|
|
|
newUrl = uri.getHost() + newUrl; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!CheckUtil.checkUrlNotThrow(newUrl)) { |
|
|
|
if (!CheckUtil.checkUrlNotThrow(newUrl)) { |
|
|
|
failDownload(new TaskException(TAG, "下载失败,重定向url错误"), false); |
|
|
|
failDownload(new TaskException(TAG, "下载失败,重定向url错误"), false); |
|
|
|
return; |
|
|
|
return; |
|
|
|