[gnome-boxes/gnome-3-14] downloader, HTTP: Ignore all chunks until redirected



commit 9b5a1a9e528dfbb7f8926e87861e908f8aadc17d
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Oct 24 18:51:20 2014 +0100

    downloader,HTTP: Ignore all chunks until redirected
    
    In case of HTTP redirection, first chunks we get are of the HTML
    document we recieve from the original URL we tried to download. Lets
    ignore those bytes and only save the chunks of the target resource.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=738168

 src/downloader.vala |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/src/downloader.vala b/src/downloader.vala
index f64b1b7..ca3e04d 100644
--- a/src/downloader.vala
+++ b/src/downloader.vala
@@ -137,6 +137,9 @@ private class Boxes.Downloader : GLib.Object {
         int64 current_num_bytes = 0;
         // FIXME: Reduce lambda nesting by splitting out downloading to Download class
         msg.got_chunk.connect ((msg, chunk) => {
+            if (session.would_redirect (msg))
+                return;
+
             current_num_bytes += chunk.length;
             try {
                 // Write synchronously as we have no control over order of async


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]