[IOT-990] Support for URI comparisons to be case-insenstive
authorHabib Virji <habib.virji@samsung.com>
Wed, 23 Mar 2016 21:31:47 +0000 (21:31 +0000)
committerHabib Virji <habib.virji@samsung.com>
Tue, 19 Apr 2016 14:41:27 +0000 (14:41 +0000)
Support for rt or if in the query to be case-insensitive.

JIRA ISSUE: IOT-990
Signed-off-by: Habib Virji <habib.virji@samsung.com>
Change-Id: Ieff5256e25b2232f25dec52e86b356a0682e3241
Reviewed-on: https://gerrit.iotivity.org/gerrit/6237
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
(cherry picked from commit 34df9a3c8865ea31c1bfc2dd18198733ec05f2aa)
Reviewed-on: https://gerrit.iotivity.org/gerrit/7829

resource/csdk/stack/src/ocresource.c

index b323481..cd05deb 100755 (executable)
 // For POSIX.1-2001 base specification,
 // Refer http://pubs.opengroup.org/onlinepubs/009695399/
 #define _POSIX_C_SOURCE 200112L
+
+#ifdef WITH_ARDUINO
 #include <string.h>
+#else
+#include <strings.h>
+#endif
+
 #include "ocresource.h"
 #include "ocresourcehandler.h"
 #include "ocobserve.h"
@@ -141,11 +147,11 @@ static OCStackResult ExtractFiltersFromQuery(char *query, char **filterOne, char
         {
             return OC_STACK_INVALID_QUERY;
         }
-        else if (strcmp (key, OC_RSRVD_INTERFACE) == 0)
+        else if (strncasecmp(key, OC_RSRVD_INTERFACE, sizeof(OC_RSRVD_INTERFACE) - 1) == 0)
         {
             *filterOne = value;     // if
         }
-        else if (strcmp (key, OC_RSRVD_RESOURCE_TYPE) == 0)
+        else if (strncasecmp(key, OC_RSRVD_RESOURCE_TYPE, sizeof(OC_RSRVD_INTERFACE) - 1) == 0)
         {
             *filterTwo = value;     // rt
         }
@@ -159,7 +165,7 @@ static OCStackResult ExtractFiltersFromQuery(char *query, char **filterOne, char
         keyValuePair = strtok_r(NULL, OC_QUERY_SEPARATOR, &restOfQuery);
     }
 
-    OIC_LOG_V(INFO, TAG, "Extracted params %s and %s.", *filterOne, *filterTwo);
+    OIC_LOG_V(INFO, TAG, "Extracted params if: %s and rt: %s.", *filterOne, *filterTwo);
     return OC_STACK_OK;
 }