[rygel/rygel-0-18] renderer: Work-around peers not supporting HEAD



commit de9b1a2b82f4935d8f3c091e49949b2c2cb6e77d
Author: Jens Georg <jensg openismus com>
Date:   Tue May 7 23:49:33 2013 +0200

    renderer: Work-around peers not supporting HEAD
    
    If a peer does not support HEAD, fall back to GET and cancel the message after
    the got_headers signal so we basically fake a HEAD request and only if that
    fails, fail completely.
    
    Conflicts:
        src/librygel-renderer/rygel-av-transport.vala

 src/librygel-renderer/rygel-av-transport.vala |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/src/librygel-renderer/rygel-av-transport.vala b/src/librygel-renderer/rygel-av-transport.vala
index 4305469..b6d970f 100644
--- a/src/librygel-renderer/rygel-av-transport.vala
+++ b/src/librygel-renderer/rygel-av-transport.vala
@@ -247,17 +247,15 @@ internal class Rygel.AVTransport : Service {
             message.request_headers.append ("getContentFeatures.dlna.org",
                                             "1");
             message.finished.connect ((msg) => {
-                // Server does not support HEAD request
-                if (msg.status_code == KnownStatusCode.BAD_REQUEST) {
-                    action.return ();
-
-                    // FIXME: no chance to check for playlists.
-                    this.controller.metadata = _metadata;
-                    this.controller.uri = _uri;
-                    this.controller.n_tracks = 1;
-                    this.controller.track = 1;
-                    this.track_metadata = _metadata;
-                    this.track_uri = _uri;
+                if (msg.status_code != KnownStatusCode.OK &&
+                    msg.method == "HEAD") {
+                    debug ("Peer does not support HEAD, trying GET");
+                    msg.method = "GET";
+                    msg.got_headers.connect ((msg) => {
+                        this.session.cancel_message (msg, msg.status_code);
+                    });
+
+                    this.session.queue_message (msg, null);
 
                     return;
                 }


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