summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Georg <jensg@openismus.com>2013-05-07 23:49:33 +0200
committerJens Georg <jensg@openismus.com>2013-05-07 23:50:57 +0200
commit769bd7e922e60c71a31535ec921cd438c0d6934b (patch)
treef9c06ab487a96029fd1b60969018d787db4301e6
parentf61fde31da2cab347313c40fc300838fb56f9d23 (diff)
downloadrygel-769bd7e922e60c71a31535ec921cd438c0d6934b.tar.gz
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.
-rw-r--r--src/librygel-renderer/rygel-av-transport.vala21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/librygel-renderer/rygel-av-transport.vala b/src/librygel-renderer/rygel-av-transport.vala
index c5df54d1..b6d970fd 100644
--- a/src/librygel-renderer/rygel-av-transport.vala
+++ b/src/librygel-renderer/rygel-av-transport.vala
@@ -247,18 +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 ||
- msg.status_code == KnownStatusCode.MALFORMED) {
- 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;
}