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



commit e4116c5cd0be7b8555e87f02e6dabd87f7b8d4bd
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 9c4ecb7..f2e86a4 100644
--- a/src/downloader.vala
+++ b/src/downloader.vala
@@ -143,6 +143,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]