Skip to content

Commit f1cbeff

Browse files
author
Tianhua Ran
committed
fix: close automation redirects of HttpUrlConnection
Closes #1295
1 parent 91228db commit f1cbeff

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

library/src/main/java/com/liulishuo/filedownloader/connection/FileDownloadUrlConnection.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public FileDownloadUrlConnection(URL url, Configuration configuration) throws IO
4646
} else {
4747
mConnection = url.openConnection();
4848
}
49+
if (mConnection instanceof HttpURLConnection) {
50+
((HttpURLConnection) mConnection).setInstanceFollowRedirects(false);
51+
}
4952

5053
if (configuration != null) {
5154
if (configuration.readTimeout != null) {

0 commit comments

Comments
 (0)