Fix for request to secure resource server. 61/12561/3
authorKIM JungYong <jyong2.kim@samsung.com>
Thu, 29 Sep 2016 11:43:29 +0000 (20:43 +0900)
committerUze Choi <uzchoi@samsung.com>
Fri, 30 Sep 2016 06:06:21 +0000 (06:06 +0000)
When send to discovered secure resource server,
client should change port to secure channel port.
But, it is not apply at notification consumer service.
In this patch, when discover secure notification resource
consumer service will send request with changed port for secure.

Change-Id: Ib8101753be76996fa4978d7714e8cf474278f771
Signed-off-by: KIM JungYong <jyong2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/12561
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Chihyun Cho <ch79.cho@samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/notification/src/consumer/NSConsumerDiscovery.c

index b90d553..d0d3f3f 100644 (file)
@@ -124,7 +124,14 @@ OCStackApplicationResult NSProviderDiscoverListener(
                 type = CT_ADAPTER_TCP;
             }
 
-            NSInvokeRequest(NULL, OC_REST_GET, clientResponse->addr,
+            OCDevAddr * addr = clientResponse->addr;
+            if (resource->secure)
+            {
+                addr->port = resource->port;
+                addr->flags |= OC_FLAG_SECURE;
+            }
+
+            NSInvokeRequest(NULL, OC_REST_GET, addr,
                     resource->uri, NULL, NSIntrospectProvider, ctx,
                     type);
         }