[rygel] server:Fixing UPnP Error codes for Browse/Search



commit e2d14b17c3f2ad7c8b3e5c2385d42cac3ef85bdb
Author: Parthiban Balasubramanian <p balasubramanian cablelabs com>
Date:   Sat Aug 3 14:17:48 2013 -0600

    server:Fixing UPnP Error codes for Browse/Search
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705576

 src/librygel-server/rygel-content-directory.vala  |    1 +
 src/librygel-server/rygel-media-query-action.vala |   16 ++++++++++++++--
 src/librygel-server/rygel-search.vala             |    3 ++-
 3 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/src/librygel-server/rygel-content-directory.vala 
b/src/librygel-server/rygel-content-directory.vala
index adf2f24..c63d7fa 100644
--- a/src/librygel-server/rygel-content-directory.vala
+++ b/src/librygel-server/rygel-content-directory.vala
@@ -36,6 +36,7 @@ internal errordomain Rygel.ContentDirectoryError {
     REQUIRED_TAG = 704,
     READ_ONLY_TAG = 705,
     PARAMETER_MISMATCH = 706,
+    INVALID_SEARCH_CRITERIA = 708,
     INVALID_SORT_CRITERIA = 709,
     NO_SUCH_CONTAINER = 710,
     RESTRICTED_OBJECT = 711,
diff --git a/src/librygel-server/rygel-media-query-action.vala 
b/src/librygel-server/rygel-media-query-action.vala
index b0b5b0a..fef2bbf 100644
--- a/src/librygel-server/rygel-media-query-action.vala
+++ b/src/librygel-server/rygel-media-query-action.vala
@@ -93,6 +93,13 @@ internal abstract class Rygel.MediaQueryAction : GLib.Object, StateMachine {
 
     protected virtual void parse_args () throws Error {
         int64 index, requested_count;
+
+        // Browse and Search action must have 6 mandatory arguments
+        if (action.get_argument_count () != 6) {
+            throw new ContentDirectoryError.INVALID_ARGS
+                                        (_("Invalid number of arguments"));
+        }
+
         this.action.get (this.object_id_arg,
                              typeof (string),
                              out this.object_id,
@@ -182,8 +189,13 @@ internal abstract class Rygel.MediaQueryAction : GLib.Object, StateMachine {
             var media_object = yield this.root_container.find_object
                                         (this.object_id, this.cancellable);
             if (media_object == null) {
-                throw new ContentDirectoryError.NO_SUCH_OBJECT
-                                        (_("No such object"));
+                if (this.object_id_arg == "ObjectID"){
+                    throw new ContentDirectoryError.NO_SUCH_OBJECT
+                                            (_("No such object"));
+                }else{
+                    throw new ContentDirectoryError.NO_SUCH_CONTAINER
+                                            (_("No such container"));
+                }
             }
             debug ("object '%s' found.", this.object_id);
 
diff --git a/src/librygel-server/rygel-search.vala b/src/librygel-server/rygel-search.vala
index 4ae99b5..6b936d1 100644
--- a/src/librygel-server/rygel-search.vala
+++ b/src/librygel-server/rygel-search.vala
@@ -66,7 +66,8 @@ internal class Rygel.Search:  Rygel.MediaQueryAction {
         yield parser.run ();
 
         if (parser.err != null) {
-            throw parser.err;
+            throw new ContentDirectoryError.INVALID_SEARCH_CRITERIA
+                                        ("Invalid search criteria given");
         }
 
         var sort_criteria = this.sort_criteria ?? container.sort_criteria;


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