summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorDave Thaler <dthaler@microsoft.com>2016-11-12 17:57:16 +0900
committerAshok Babu Channa <ashok.channa@samsung.com>2016-11-17 05:54:54 +0000
commit38dc195402aa4c8d8792d29d84b1889918d9a570 (patch)
treed8301572db21b4757b1f387c702cb691714d939b /service
parentaf6e4e092adc640f5537a14f2012412a47367e39 (diff)
downloadiotivity-38dc195402aa4c8d8792d29d84b1889918d9a570.tar.gz
iotivity-38dc195402aa4c8d8792d29d84b1889918d9a570.tar.bz2
iotivity-38dc195402aa4c8d8792d29d84b1889918d9a570.zip
[IOT-1513] Incorrect URI construction
The % character is not legal to be placed literally in a URI, it must be escaped (as "%25") before being enclosed in a URI. Other places were changed in July in change 9419, and some more in change 14009, but these code paths were not changed at that time. This also fixes a bug in setHost which did not mark an IPv6 address as IPv6, and adds a test case that covers this. Change-Id: I1331ecb9c5482a2d43dd675978a1f34c6d37cb4c Signed-off-by: Dave Thaler <dthaler@microsoft.com> Reviewed-on: https://gerrit.iotivity.org/gerrit/14273 Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org> Reviewed-by: jihwan seo <jihwan.seo@samsung.com> Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com> Reviewed-by: Larry Sachs <larry.j.sachs@intel.com> Reviewed-by: Rick Bell <richard.s.bell@intel.com> Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
Diffstat (limited to 'service')
-rwxr-xr-xservice/scene-manager/src/SceneUtils.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/service/scene-manager/src/SceneUtils.cpp b/service/scene-manager/src/SceneUtils.cpp
index b99eaf892..5b1ad5fa5 100755
--- a/service/scene-manager/src/SceneUtils.cpp
+++ b/service/scene-manager/src/SceneUtils.cpp
@@ -95,7 +95,18 @@ namespace OIC
+ std::to_string(netInfo[i].port);
} else if(netInfo[i].flags == CATransportFlags_t::CA_IPV6)
{
- address_ipv6 = "[" + std::string(netInfo[i].addr) + "]:"
+ char addressEncoded[CA_MAX_URI_LENGTH] = {0};
+
+ OCStackResult result = OCEncodeAddressForRFC6874(addressEncoded,
+ sizeof(addressEncoded),
+ netInfo[i].addr);
+ if (OC_STACK_OK != result)
+ {
+ OICFree(netInfo);
+ throw RCSException("address encoding error");
+ }
+
+ address_ipv6 = "[" + std::string(addressEncoded) + "]:"
+ std::to_string(netInfo[i].port);
}
}