diff --git a/.gradle/2.10/taskArtifacts/cache.properties.lock b/.gradle/2.10/taskArtifacts/cache.properties.lock index 7319ef38..8028ab66 100644 Binary files a/.gradle/2.10/taskArtifacts/cache.properties.lock and b/.gradle/2.10/taskArtifacts/cache.properties.lock differ diff --git a/.gradle/2.10/taskArtifacts/fileHashes.bin b/.gradle/2.10/taskArtifacts/fileHashes.bin index 847b73d1..8a7f154f 100644 Binary files a/.gradle/2.10/taskArtifacts/fileHashes.bin and b/.gradle/2.10/taskArtifacts/fileHashes.bin differ diff --git a/.gradle/2.10/taskArtifacts/fileSnapshots.bin b/.gradle/2.10/taskArtifacts/fileSnapshots.bin index 353e011c..3ea7460a 100644 Binary files a/.gradle/2.10/taskArtifacts/fileSnapshots.bin and b/.gradle/2.10/taskArtifacts/fileSnapshots.bin differ diff --git a/.gradle/2.10/taskArtifacts/outputFileStates.bin b/.gradle/2.10/taskArtifacts/outputFileStates.bin index 40b3d78e..f2e8147b 100644 Binary files a/.gradle/2.10/taskArtifacts/outputFileStates.bin and b/.gradle/2.10/taskArtifacts/outputFileStates.bin differ diff --git a/.gradle/2.10/taskArtifacts/taskArtifacts.bin b/.gradle/2.10/taskArtifacts/taskArtifacts.bin index 7bb5790b..1719f5d5 100644 Binary files a/.gradle/2.10/taskArtifacts/taskArtifacts.bin and b/.gradle/2.10/taskArtifacts/taskArtifacts.bin differ diff --git a/.idea/misc.xml b/.idea/misc.xml index fbb68289..5d199810 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -37,7 +37,7 @@ - + diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/util/DownLoadUtil.java b/downloadutil/src/main/java/com/arialyy/downloadutil/util/DownLoadUtil.java index a7b54427..d0b004eb 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/util/DownLoadUtil.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/util/DownLoadUtil.java @@ -142,11 +142,11 @@ final class DownLoadUtil { HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setRequestProperty("Charset", "UTF-8"); - conn.setConnectTimeout(TIME_OUT * 4); conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"); conn.setRequestProperty("Accept", "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*"); + conn.setConnectTimeout(TIME_OUT * 4); conn.connect(); int len = conn.getContentLength(); if (len < 0) { //网络被劫持时会出现这个问题 @@ -290,11 +290,11 @@ final class DownLoadUtil { "bytes=" + dEntity.startLocation + "-" + dEntity.endLocation); conn.setRequestMethod("GET"); conn.setRequestProperty("Charset", "UTF-8"); - conn.setConnectTimeout(TIME_OUT * 4); conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"); conn.setRequestProperty("Accept", "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*"); + conn.setConnectTimeout(TIME_OUT * 4); conn.setReadTimeout(TIME_OUT * 24); //设置读取流的等待时间,必须设置该参数 InputStream is = conn.getInputStream(); //创建可设置位置的文件 @@ -323,6 +323,7 @@ final class DownLoadUtil { } file.close(); is.close(); + if (isCancel) { synchronized (DownLoadUtil.this) { mCancelNum++;