Re: [core] HTTP-CoAP default URI mapping: some draft proposals

Bert Greevenbosch <Bert.Greevenbosch@huawei.com> Tue, 14 May 2013 01:19 UTC

Return-Path: <Bert.Greevenbosch@huawei.com>
X-Original-To: core@ietfa.amsl.com
Delivered-To: core@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 9648B11E80D9 for <core@ietfa.amsl.com>; Mon, 13 May 2013 18:19:35 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.094
X-Spam-Level:
X-Spam-Status: No, score=-0.094 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, HTML_MESSAGE=0.001, MANGLED_SAVELE=2.3, MIME_BASE64_TEXT=1.753, MIME_CHARSET_FARAWAY=2.45, RCVD_IN_DNSWL_MED=-4, WEIRD_PORT=0.001]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YdRYPuqm4m4O for <core@ietfa.amsl.com>; Mon, 13 May 2013 18:19:30 -0700 (PDT)
Received: from lhrrgout.huawei.com (lhrrgout.huawei.com [194.213.3.17]) by ietfa.amsl.com (Postfix) with ESMTP id 4D65511E80A2 for <core@ietf.org>; Mon, 13 May 2013 18:19:29 -0700 (PDT)
Received: from 172.18.7.190 (EHLO lhreml204-edg.china.huawei.com) ([172.18.7.190]) by lhrrg02-dlp.huawei.com (MOS 4.3.5-GA FastPath queued) with ESMTP id ARI71925; Tue, 14 May 2013 01:19:26 +0000 (GMT)
Received: from LHREML401-HUB.china.huawei.com (10.201.5.240) by lhreml204-edg.china.huawei.com (172.18.7.223) with Microsoft SMTP Server (TLS) id 14.1.323.7; Tue, 14 May 2013 02:19:05 +0100
Received: from SZXEML452-HUB.china.huawei.com (10.82.67.195) by lhreml401-hub.china.huawei.com (10.201.5.240) with Microsoft SMTP Server (TLS) id 14.1.323.7; Tue, 14 May 2013 02:19:25 +0100
Received: from szxeml558-mbx.china.huawei.com ([169.254.7.35]) by szxeml452-hub.china.huawei.com ([10.82.67.195]) with mapi id 14.01.0323.007; Tue, 14 May 2013 09:19:19 +0800
From: Bert Greevenbosch <Bert.Greevenbosch@huawei.com>
To: "Dijk, Esko" <esko.dijk@philips.com>, "core (core@ietf.org)" <core@ietf.org>
Thread-Topic: HTTP-CoAP default URI mapping: some draft proposals
Thread-Index: Ac5P0diKwuFDFUSHQoafxpmnmeVw4AAbRkoA
Date: Tue, 14 May 2013 01:19:18 +0000
Message-ID: <46A1DF3F04371240B504290A071B4DB63D7271BD@szxeml558-mbx.china.huawei.com>
References: <031DD135F9160444ABBE3B0C36CED618C2BC0E@011-DB3MPN2-082.MGDPHG.emi.philips.com>
In-Reply-To: <031DD135F9160444ABBE3B0C36CED618C2BC0E@011-DB3MPN2-082.MGDPHG.emi.philips.com>
Accept-Language: en-GB, zh-CN, en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [10.66.162.63]
Content-Type: multipart/alternative; boundary="_000_46A1DF3F04371240B504290A071B4DB63D7271BDszxeml558mbxchi_"
MIME-Version: 1.0
X-CFilter-Loop: Reflected
Subject: Re: [core] HTTP-CoAP default URI mapping: some draft proposals
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "Constrained RESTful Environments \(CoRE\) Working Group list" <core.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/core>, <mailto:core-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/core>
List-Post: <mailto:core@ietf.org>
List-Help: <mailto:core-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/core>, <mailto:core-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 14 May 2013 01:19:35 -0000

Hi Esko,

Thank you for your extensive description of the options and requirements.

I ponder between #1 and #4. I think #1 is easier to parse, but it misses the scheme indication as is possible in #4. The scheme indicator needs a bit extra complexity though, as the parser needs to determine whether the HTTP URI component is a scheme indicator, or the domain name part. I guess there will never be domain names "coap" and "coaps" (I hope these domain names are forbidden?) so we should be safe with that.

If we have a default coap scheme, I think constructs like
http://proxy.example.com/.well-known/core-translate//server.coap.example.com/4567/foo%2Fbar/a=3&b=5
should be forbidden.

Another problem is how to handle the default port 5683. Does it need to be included in the HTTP URI or not? I think we should be clear on this, such that there is no ambiguity whether two different HTTP URIs point to the same resource or not. I guess in scheme #4 we should mandate inclusion of the port number in the HTTP URI, as otherwise the port number can be confused with the path component.

Best regards,
Bert


From: core-bounces@ietf.org [mailto:core-bounces@ietf.org] On Behalf Of Dijk, Esko
Sent: 2013年5月13日 20:18
To: core (core@ietf.org)
Subject: [core] HTTP-CoAP default URI mapping: some draft proposals


Dear all,



below I’ve listed a number of proposals that the authors of draft-castellani-core-http-mapping discussed. The formal specification of the solutions (in terms of URI template) is mostly missing, but hopefully the examples make the main ideas clear. Each example shows a http URI, with which a HTTP-CoAP cross-protocol proxy at host ‘proxy.example.com’ is called. After the arrow (->) the extracted CoAP URI is shown, via which the CoAP server at ‘server.coap.example.com’ is called by the proxy.



After the solutions there’s a short table showing my personal (not with my co-authors) first analysis of how each solution meets the requirements. The requirements were posted on May 8th to the list.

Any feedback is welcomed!



regards,

Esko



---



Solution #0: placeholder proposal in draft-bormann-core-cross-reverse-convention-00



URI template: tbd



Example:

      http://proxy.example.com/.well-known/core-translate/1.2.3.4_4567/foo/bar?a=3&b=5

-> coap://1.2.3.4:4567/foo/bar?a=3&b=5



Notes: how to include IPv6 literals was not defined. CoAP scheme is derived from HTTP scheme (http or https). ‘_{Port}’ part is optional.





Solution #1: adding IPv6 support to #0



URI Template:

/.well-known/core-translate/{authority-encoded}/{path}?{query}



Notes: the proxy will percent-decode the {authority-encoded} to {authority} before constructing the COAP URI. CoAP scheme is derived from HTTP scheme (http or https).



Examples:

                http://proxy.example.com/.well-known/core-translate/%5B2001::23:25%5D:4567/foo/bar?a=3&b=5

->            coap://[2001::23:25]:4567/foo/bar?a=3&b=5



                http://proxy.example.com/.well-known/core-translate/server.coap.example.com:4567/foo/bar?a=3&b=5

->            coap://server.coap.example.com:4567/foo/bar?a=3&b=5



                http://proxy.example.com/.well-known/core-translate/server.coap.example.com/foo/bar?a=3&b=5

->            coap://server.coap.example.com/foo/bar?a=3&b=5



                http://proxy.example.com/.well-known/core-translate/1.2.3.4:4567/foo/bar?a=3&b=5

->            coap://1.2.3.4:4567/foo/bar?a=3&b=5





Solution #2: Split CoAP URI in parts and put parts in query arguments



URI Template:

/.well-known/core-translate/host={host}&port={port}&path={path}?{query}



Note: the query parts ‘host’, ‘port’  , ‘path’ and ‘query’ are all optional in the URI.



http://proxy.example.com/.well-known/core-translate?host=%5B1234::5678%5D&port=4567&path=/foo/bar?a=3&b=5

->            coap://[1234::5678]:4567/foo/bar?a=3&b=5



Solution #3: Entire CoAP URI as single query parameter

Inspired by certain web services that put http callback URIs in URI-query parameters.



URI template: tbd



Example:

http://proxy.example.com/.well-known/core-translate?uri=coap%3A%2F%2F%5B1234%3A%3A5678%5D%3A4567%2Ffoo%2Fbar%3Fb%3Dbefore_colon%253Aafter_colon

->            coap://[1234::5678]:4567/foo/bar?b=before_colon%3Aafter_colon





Solution #4: split CoAP URI in parts and put these parts in path components



URI template:

/.well-known/core-translate/{scheme}/{+host}/{port}/{+path_abempty}/{+query}



where:

  scheme        = "coap" / "coaps" / ""



  host          = matches production defined in RFC 3986 Sec. 3.2.2.

                  NOTE: need to percent-encode '[' and ']' in IP-literal



  port          = matches production defined in RFC 3986 Sec. 3.2.3.



  path_abempty  = matches production defined in RFC 3986 Sec. 3.3.

                  NOTE: need to percent-encode any '/' occurrence



  query         = matches production defined in RFC 3986 Sec. 3.4.

                  NOTE: need to percent-encode any '/' and '?' occurrence



  CoAP URI is reconstructed as per RFC 3986 Sec. 5.3. carrying out the

  following substitutions before going through the algorithm:



  - if scheme is the empty string, make it "coap";

  - if port is the empty string, make it "5683";

[[ - if path-abempty is the empty string, make it "/"; -- possibly not needed ]]

Example:
http://proxy.example.com/.well-known/core-translate/coap/server.coap.example.com/4567/foo%2Fbar/a=3&b=5

->            coap://server.coap.example.com:4567/foo/bar?a=3&b=5

---

URI mapping requirements


Note for the current requirements : there’s currently no requirement that the HTTP client should somehow communicate, in the HTTP request, specific CoAP Option values to the proxy, e.g. whether the proxy should use the Observe option or not in a CoAP request. We assume, for now, that is correct.

R1. Syntactic correctness of the HTTP URI (e.g. handle percent-encoding when needed);

R2. HTTP URI must be able include all elements of a CoAP URI
    (e.g. coap(s) scheme, hostname, host literals IPv4/IPv6, port, path, query components, characters allowed in CoAP URI)

R3. The mapping operation must produce a string that can be directly used by a proxy as input to the process of core-coap section 6.4. "Decomposing URIs into Options".

R4. HTTP URI should be easily readable/writable by humans, if possible;
    (e.g. easy to read the CoAP URI embedded in it; avoid multiple levels of percent encoding, etc.)

R5. HTTP cache friendliness of the mapping solution, i.e. maximize the caching of CoAP resources by HTTP intermediaries;
   (e.g. a solution where entire CoAP URI is provided as a single query parameter is bad in this respect)

R6. Normalised form: preferably there should be only one "normal"/default way to encode the URI
    (e.g. so that we don't end up with multiple different cache entries for the same CoAP resource in intermediaries.);

R7. HTTP URI should be as short as possible.

   #0 #1 #2 #3 #4
R1  +  +  +  +  +
R2  -  +  +  +  +
R3  +  +  +  +  +  (where details need to be defined for each solution)
R4  +  +  o  -  o
R5  +  +  -  -  +
R6  <to be checked>
R7  +  +  -  -  +/o
                     ^
     tentative best option, #1





________________________________
The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.