[rygel] core: Check received data size



commit 364e9b1b6a775d379b33c739cf9b98e7cef513cd
Author: Jens Georg <mail jensge org>
Date:   Wed Jun 1 13:19:30 2011 +0200

    core: Check received data size
    
    If the server closes the connection gracefully during transfer, Soup
    doesn't give us an error. So we compare the expeted to the received
    number of bytes and set the state accordingly.
    
    Partially fixes UPnP CTT AV-CD:1-12.1

 src/rygel/rygel-import-resource.vala |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/rygel/rygel-import-resource.vala b/src/rygel/rygel-import-resource.vala
index 69cbdc6..6ed5fea 100644
--- a/src/rygel/rygel-import-resource.vala
+++ b/src/rygel/rygel-import-resource.vala
@@ -229,6 +229,14 @@ internal class Rygel.ImportResource : GLib.Object, Rygel.StateMachine {
     }
 
     private void got_body_cb (Message message) {
+        if (this.bytes_total == 0) {
+            this.bytes_total = this.bytes_copied;
+        } else if (this.bytes_total != this.bytes_copied) {
+            this.status = TransferStatus.ERROR;
+
+            return;
+        }
+
         try {
             this.output_stream.close (this.cancellable);
             if (this.status == TransferStatus.IN_PROGRESS) {



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