[rygel] core,mediathek: Don't use deprecated libsoup API



commit bccfe752674416b910614e0ffa0e67ca9a3b1d85
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Aug 11 18:39:36 2010 +0300

    core,mediathek: Don't use deprecated libsoup API
    
    Replace usage of Soup.MessageHeaders.get() with get_one().

 .../mediathek/rygel-mediathek-rss-container.vala   |    4 ++--
 src/rygel/rygel-http-byte-seek.vala                |    6 +++---
 src/rygel/rygel-http-get-handler.vala              |    4 ++--
 src/rygel/rygel-http-get.vala                      |    3 ++-
 src/rygel/rygel-http-time-seek.vala                |    5 +++--
 src/rygel/rygel-seekable-response.vala             |    2 +-
 src/rygel/rygel-xbox-hacks.vala                    |    2 +-
 tests/rygel-http-byte-seek-test.vala               |    4 ++--
 tests/rygel-http-time-seek-test.vala               |    2 +-
 9 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/src/plugins/mediathek/rygel-mediathek-rss-container.vala b/src/plugins/mediathek/rygel-mediathek-rss-container.vala
index 861c96e..d069b15 100644
--- a/src/plugins/mediathek/rygel-mediathek-rss-container.vala
+++ b/src/plugins/mediathek/rygel-mediathek-rss-container.vala
@@ -36,8 +36,8 @@ public class Rygel.Mediathek.RssContainer : Rygel.SimpleContainer {
             case 200:
                 if (parse_response ((string) msg.response_body.data,
                                     (size_t) msg.response_body.length)) {
-                    last_modified = new Soup.Date.from_string(
-                                            msg.response_headers.get ("Date"));
+                    last_modified = new Soup.Date.from_string (
+                                        msg.response_headers.get_one ("Date"));
                 }
                 break;
             default:
diff --git a/src/rygel/rygel-http-byte-seek.vala b/src/rygel/rygel-http-byte-seek.vala
index 39f6073..2af8d28 100644
--- a/src/rygel/rygel-http-byte-seek.vala
+++ b/src/rygel/rygel-http-byte-seek.vala
@@ -36,7 +36,7 @@ internal class Rygel.HTTPByteSeek : Rygel.HTTPSeek {
         }
         var stop = total_length - 1;
 
-        range = request.msg.request_headers.get ("Range");
+        range = request.msg.request_headers.get_one ("Range");
         if (range != null) {
             // We have a Range header. Parse.
             if (!range.has_prefix ("bytes=")) {
@@ -83,8 +83,8 @@ internal class Rygel.HTTPByteSeek : Rygel.HTTPSeek {
                      (request.thumbnail != null && request.thumbnail.size > 0) ||
                      (request.subtitle != null && request.subtitle.size > 0);
 
-        var range = request.msg.request_headers.get ("Range");
-        var agent = request.msg.request_headers.get ("User-Agent");
+        var range = request.msg.request_headers.get_one ("Range");
+        var agent = request.msg.request_headers.get_one ("User-Agent");
 
         if (!needed && range != null && agent != "PLAYSTATION 3") {
             throw new HTTPRequestError.UNACCEPTABLE ("Invalid seek request");
diff --git a/src/rygel/rygel-http-get-handler.vala b/src/rygel/rygel-http-get-handler.vala
index f23ab17..5d11cbd 100644
--- a/src/rygel/rygel-http-get-handler.vala
+++ b/src/rygel/rygel-http-get-handler.vala
@@ -33,7 +33,7 @@ internal abstract class Rygel.HTTPGetHandler: GLib.Object {
     // Add response headers.
     public virtual void add_response_headers (HTTPGet request)
                                               throws HTTPRequestError {
-        var mode = request.msg.request_headers.get ("transferMode.dlna.org");
+        var mode = request.msg.request_headers.get_one ("transferMode.dlna.org");
         if (mode != null) {
             // FIXME: Is it OK to just copy the value of this header from
             // request to response? All we do to entertain this header is to
@@ -61,7 +61,7 @@ internal abstract class Rygel.HTTPGetHandler: GLib.Object {
         }
 
         // Handle Samsung DLNA TV proprietary subtitle headers
-        if (request.msg.request_headers.get ("getCaptionInfo.sec") != null &&
+        if (request.msg.request_headers.get_one ("getCaptionInfo.sec") != null &&
             request.item.subtitles.size > 0) {
                 var caption_uri = request.http_server.create_uri_for_item (
                                         request.item,
diff --git a/src/rygel/rygel-http-get.vala b/src/rygel/rygel-http-get.vala
index 2d7a327..eeadeb5 100644
--- a/src/rygel/rygel-http-get.vala
+++ b/src/rygel/rygel-http-get.vala
@@ -48,7 +48,8 @@ internal class Rygel.HTTPGet : HTTPRequest {
     }
 
     protected override async void handle () throws Error {
-        var header = this.msg.request_headers.get ("getcontentFeatures.dlna.org");
+        var header = this.msg.request_headers.get_one (
+                                        "getcontentFeatures.dlna.org");
 
         /* We only entertain 'HEAD' and 'GET' requests */
         if ((this.msg.method != "HEAD" && this.msg.method != "GET") ||
diff --git a/src/rygel/rygel-http-time-seek.vala b/src/rygel/rygel-http-time-seek.vala
index 7834d0e..7a7ee3e 100644
--- a/src/rygel/rygel-http-time-seek.vala
+++ b/src/rygel/rygel-http-time-seek.vala
@@ -38,7 +38,7 @@ internal class Rygel.HTTPTimeSeek : Rygel.HTTPSeek {
         int64 duration = request.item.duration * SECOND;
         int64 stop = duration - SECOND;
 
-        range = request.msg.request_headers.get ("TimeSeekRange.dlna.org");
+        range = request.msg.request_headers.get_one ("TimeSeekRange.dlna.org");
         if (range != null) {
             if (!range.has_prefix ("npt=")) {
                 throw new HTTPSeekError.INVALID_RANGE ("Invalid Range '%s'",
@@ -86,7 +86,8 @@ internal class Rygel.HTTPTimeSeek : Rygel.HTTPSeek {
                        request.item.should_stream ()));
 
         if (!needed &&
-            request.msg.request_headers.get ("TimeSeekRange.dlna.org") != null) {
+            request.msg.request_headers.get_one ("TimeSeekRange.dlna.org") !=
+            null) {
             throw new HTTPRequestError.UNACCEPTABLE ("Invalid seek request");
         }
 
diff --git a/src/rygel/rygel-seekable-response.vala b/src/rygel/rygel-seekable-response.vala
index befc48b..4a68f16 100644
--- a/src/rygel/rygel-seekable-response.vala
+++ b/src/rygel/rygel-seekable-response.vala
@@ -162,7 +162,7 @@ internal class Rygel.SeekableResponse : Rygel.HTTPResponse {
     }
 
     private int get_requested_priority () {
-        var mode = this.msg.request_headers.get ("transferMode.dlna.org");
+        var mode = this.msg.request_headers.get_one ("transferMode.dlna.org");
 
         if (mode == null || mode == "Interactive") {
             return Priority.DEFAULT;
diff --git a/src/rygel/rygel-xbox-hacks.vala b/src/rygel/rygel-xbox-hacks.vala
index df4cee2..8a0676f 100644
--- a/src/rygel/rygel-xbox-hacks.vala
+++ b/src/rygel/rygel-xbox-hacks.vala
@@ -37,7 +37,7 @@ internal class Rygel.XBoxHacks : GLib.Object {
     private static string MODEL_NAME = "Windows Media Connect";
 
     public XBoxHacks.for_action (ServiceAction action) throws XBoxHacksError {
-        var agent = action.get_message ().request_headers.get ("User-Agent");
+        var agent = action.get_message ().request_headers.get_one ("User-Agent");
         if (!agent.contains ("Xbox")) {
             throw new XBoxHacksError.NA (_("Not Applicable"));
         }
diff --git a/tests/rygel-http-byte-seek-test.vala b/tests/rygel-http-byte-seek-test.vala
index d388b0f..d6b2080 100644
--- a/tests/rygel-http-byte-seek-test.vala
+++ b/tests/rygel-http-byte-seek-test.vala
@@ -197,9 +197,9 @@ private class Rygel.HTTPByteSeekTest : GLib.Object {
             assert (seek.total_length == request.item.size);
         }
 
-        var header = request.msg.response_headers.get ("Accept-Ranges");
+        var header = request.msg.response_headers.get_one ("Accept-Ranges");
         assert (header == "bytes");
-        header = request.msg.response_headers.get ("Content-Range");
+        header = request.msg.response_headers.get_one ("Content-Range");
         assert (header != null);
         assert (this.range_regex.match (header));
 
diff --git a/tests/rygel-http-time-seek-test.vala b/tests/rygel-http-time-seek-test.vala
index d82f016..56e0b18 100644
--- a/tests/rygel-http-time-seek-test.vala
+++ b/tests/rygel-http-time-seek-test.vala
@@ -179,7 +179,7 @@ private class Rygel.HTTPTimeSeekTest : GLib.Object {
         assert (seek.length == seek.stop + 1 - seek.start);
         assert (seek.total_length == request.item.duration * SECOND);
 
-        var header = request.msg.response_headers.get (
+        var header = request.msg.response_headers.get_one (
                                         "TimeSeekRange.dlna.org");
         assert (header != null);
         assert (this.range_regex.match (header));



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