Defeat connection reuse to really cancel.
[android/platform/packages/providers/DownloadProvider.git] / src / com / android / providers / downloads / DownloadThread.java
index 51e71b2..c0f5a5e 100644 (file)
@@ -792,6 +792,10 @@ public class DownloadThread implements Runnable {
         // easily resume partial downloads.
         conn.setRequestProperty("Accept-Encoding", "identity");
 
+        // Defeat connection reuse, since otherwise servers may continue
+        // streaming large downloads after cancelled.
+        conn.setRequestProperty("Connection", "close");
+
         if (resuming) {
             if (mInfoDelta.mETag != null) {
                 conn.addRequestProperty("If-Match", mInfoDelta.mETag);