The URL / URI format is specified in RFC 3986. Section 3.2 (and its subsections) define ?authority? as the component that may include the host (which might be an IP literal or a hostname) and port.
So you?re correct that if it includes a port, then the variable should not be called ?host? but should instead be called ?authority?. From: iotivity-dev-bounces at lists.iotivity.org [mailto:[email protected]] On Behalf Of Muhammad Mushfiqul Islam Sent: Monday, July 18, 2016 7:39 AM To: Macieira, Thiago <thiago.macieira at intel.com> Cc: iotivity-dev at lists.iotivity.org Subject: Re: [dev] OcResource->getHost() api gives a tricky host address in Android Dear Mr. Thiago, I am not any designer nor developer of iotivity, but as a user, as far as I know, that const std::string& host argument is not host name, rather it is ip & port information of the host in coap://IP:Port format([IP]:Port for IPv6). The const std::string& uri is the relative uri, which should be used after IP & Port. These information are necessary to create the resource object, as Iotivity uses the resource object to send get/put/post/delete requests to a resource. - Thanks & Regards, Mushfiqul Islam Antu --------- Original Message --------- Sender : Macieira, Thiago <thiago.macieira at intel.com<mailto:thiago.macieira at intel.com>> Date : 2016-07-18 14:10 (GMT+9) Title : Re: [dev] OcResource->getHost() api gives a tricky host address in Android The correct format for the URI is "coap://[fe80::928d:78ff:feaa:2b0f%25wlan0]:56013" and the correct format for a host is "fe80::928d:78ff:feaa:2b0f%wlan0". However, that API is flawed. Why does it need a host name to construct a resource object? It would only need that if it were doing virtual hosts (which IoTivity does not support now) and if it did that, it would take the Device ID, not a host name. So I suggest you pass an empty string until a better API is created. (The API also falls into The Boolean Trap, a big and obvious API design flaw) ________________________________ From: ??? [[email protected]] Sent: Sunday, July 17, 2016 19:19 To: Antler, David A Cc: ???; ???; 'Dave Thaler'; Macieira, Thiago; ???; iotivity-dev at lists.iotivity.org<mailto:iotivity-dev at lists.iotivity.org> Subject: RE: RE: [dev] OcResource->getHost() api gives a tricky host address in Android Hi. Antler, If the current format for IPv6 address is vaild, some of APIs should be updated for adapting such an address. For instance, I'm trying to use constructResourceObject API to create OCResource object and its first parameter is a "host" address. OCResource::Ptr constructResourceObject(const std::string& host, const std::string& uri, OCConnectivityType connectivityType, bool isObservable, const std::vector<std::string>& resourceTypes, const std::vector<std::string>& interfaces); For using the API, should I put the IPv6 address like "coap://[fe80::928d:78ff:feaa:2b0f%wlan0]:56013"? Or, should I do like coap://[fe80::928d:78ff:feaa:2b0f]:56013" because this is the case where an user put this address manually? Thank you. BR, Jihun Ha. --------- Original Message --------- Sender : Antler, David A <david.a.antler at intel.com<mailto:david.a.antler at intel.com>> Date : 2016-07-18 03:22 (GMT+9) Title : RE: [dev] OcResource->getHost() api gives a tricky host address in Android Hi Jihun Ha, I think most people believe that RFC 6874 should be used in this case. Can you please confirm that, upon applying a change, the properly escaped string bubbles up into a getHost return value? Here is a gerrit changeset in development that fixes encoding of the IPv6 address in the URI using RFC 6874. https://gerrit.iotivity.org/gerrit/#/c/9419/ Regards, David Antler From: iotivity-dev-bounces at lists.iotivity.org<mailto:iotivity-dev-bounces at lists.iotivity.org> [mailto:[email protected]] On Behalf Of MyeongGi Jeong Sent: Thursday, July 14, 2016 7:58 PM To: Uze Choi <uzchoi at samsung.com<mailto:uzchoi at samsung.com>>; 'Dave Thaler' <dthaler at microsoft.com<mailto:dthaler at microsoft.com>>; Macieira, Thiago <thiago.macieira at intel.com<mailto:thiago.macieira at intel.com>>; Jihun Ha <jihun.ha at samsung.com<mailto:jihun.ha at samsung.com>> Cc: iotivity-dev at lists.iotivity.org<mailto:iotivity-dev at lists.iotivity.org> Subject: Re: [dev] OcResource->getHost() api gives a tricky host address in Android Hi, Uze. The 'caipserver.c' code chaged when Windows port branch merged. You'd better ask to David Antler, Not Ashok. Thank. Best Regards, --- MyeongGi Jeong Principle Engineer, Software Architect Software R&D Center, Samsung Electronics Co., Ltd. +82-10-3328-1130 | +82-2-6147-7699 --------- Original Message --------- Sender : ??? <uzchoi at samsung.com<mailto:uzchoi at samsung.com>> S6(??)/??/IoT Lab(S/W??)/???? Date : 2016-07-15 11:27 (GMT+9) Title : Re: [dev] OcResource->getHost() api gives a tricky host address in Android This happens in the C++/C API also. C++: OCResource.host() C : OCDevAddr->addr Ashok, Could you check it from CA layer? BR, Uze Choi -----Original Message----- From: iotivity-dev-bounces at lists.iotivity.org<mailto:iotivity-dev-bounces at lists.iotivity.org> [mailto:[email protected]] On Behalf Of Dave Thaler via iotivity-dev Sent: Friday, July 15, 2016 3:09 AM To: Thiago Macieira; iotivity-dev at lists.iotivity.org<mailto:iotivity-dev at lists.iotivity.org>; jihun.ha at samsung.com<mailto:jihun.ha at samsung.com> Subject: Re: [dev] OcResource->getHost() api gives a tricky host address in Android Correct. Per RFC 6874, the % must be escaped as in: coap://[fe80::dafe:e3ff:fe00:ebfa%25wlan0]:49593 (where %25 is the hex encoded version of '%') > -----Original Message----- > From: iotivity-dev-bounces at lists.iotivity.org<mailto:iotivity-dev-bounces > at lists.iotivity.org> [mailto:iotivity-dev- > bounces at lists.iotivity.org<mailto:bounces at lists.iotivity.org>] On > Behalf Of Thiago Macieira > Sent: Thursday, July 14, 2016 9:06 AM > To: iotivity-dev at lists.iotivity.org<mailto:iotivity-dev at > lists.iotivity.org>; jihun.ha at samsung.com<mailto:jihun.ha at samsung.com> > Subject: Re: [dev] OcResource->getHost() api gives a tricky host > address in Android > > On quinta-feira, 14 de julho de 2016 15:03:22 PDT ??? wrote: > > I'm trying to implement android sample application and found an > > unexpected information from OcResource java object. (Upon a resource > > is found in a given network, I can get a corresponding OcResource > > object in my Android sample application) OcResource has an "getHost()" > > API to get the found resource's address. > > However, it returns a tricky information like > > coap://[fe80::dafe:e3ff:fe00:ebfa%wlan0]:49593 > > Why is "wlan0" appended to IPv6 address? I tried this for IPv4 > > setting but I did not see such a string. > > Is there any person who knows this happening? > > Yes. That's an IPv6 scope ID, though the URL is invalid. The % is not > permitted there, even under RFC 6874. > > There's a bug in the getHost() function. > > -- > Thiago Macieira - thiago.macieira (AT) intel.com > Software Architect - Intel Open Source Technology Center > > _______________________________________________ > iotivity-dev mailing list > iotivity-dev at lists.iotivity.org<mailto:iotivity-dev at lists.iotivity.org> > https://lists.iotivity.org/mailman/listinfo/iotivity-dev _______________________________________________ iotivity-dev mailing list iotivity-dev at lists.iotivity.org<mailto:iotivity-dev at lists.iotivity.org> https://lists.iotivity.org/mailman/listinfo/iotivity-dev _______________________________________________ iotivity-dev mailing list iotivity-dev at lists.iotivity.org<mailto:iotivity-dev at lists.iotivity.org> https://lists.iotivity.org/mailman/listinfo/iotivity-dev [Image removed by sender.] Best Regards, Jihun Ha (???/???, Ph.D.) IoT, IoTivity, OIC | IoT Lab Software R&D Center | Samsung Electronics Co., Ltd Mobile +82 10 2533 7947 jihun.ha at samsung.com | jhha85 at gmail.com _______________________________________________ iotivity-dev mailing list iotivity-dev at lists.iotivity.org<mailto:iotivity-dev at lists.iotivity.org> https://lists.iotivity.org/mailman/listinfo/iotivity-dev [cid:image002.png at 01D1E0DB.3E9F9340] [http://v70ext.samsung.net/mail/ext/v1/external/status/update?userid=i.mushfiq&do=bWFpbElEPTIwMTYwNzE4MDUzODQwZXBjbXMxcDdhY2YzNDhmM2ZlNWEyNzhjYzc4ZDU4NDBkY2I2M2MxNSZyZWNpcGllbnRBZGRyZXNzPWlvdGl2aXR5LWRldkBsaXN0cy5pb3Rpdml0eS5vcmc_] -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20160718/64420d48/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.jpg Type: image/jpeg Size: 823 bytes Desc: image001.jpg URL: <http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20160718/64420d48/attachment.jpg> -------------- next part -------------- A non-text attachment was scrubbed... Name: image002.png Type: image/png Size: 33527 bytes Desc: image002.png URL: <http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20160718/64420d48/attachment.png>
