Re: [core] CoAP's handling of trailing slash in URI - to file erratum?

Klaus Hartke <hartke@tzi.org> Tue, 20 December 2016 12:45 UTC

Return-Path: <hartke@tzi.org>
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 A02FF1296C7 for <core@ietfa.amsl.com>; Tue, 20 Dec 2016 04:45:18 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.7
X-Spam-Level:
X-Spam-Status: No, score=-3.7 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_SORBS_SPAM=0.5] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sc0KlYYgnUhG for <core@ietfa.amsl.com>; Tue, 20 Dec 2016 04:45:17 -0800 (PST)
Received: from mailhost.informatik.uni-bremen.de (mailhost.informatik.uni-bremen.de [IPv6:2001:638:708:30c9::12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 798A31296C9 for <core@ietf.org>; Tue, 20 Dec 2016 04:45:17 -0800 (PST)
X-Virus-Scanned: amavisd-new at informatik.uni-bremen.de
Received: from submithost.informatik.uni-bremen.de (submithost.informatik.uni-bremen.de [134.102.201.11]) by mailhost.informatik.uni-bremen.de (8.14.5/8.14.5) with ESMTP id uBKCj9rl017123 for <core@ietf.org>; Tue, 20 Dec 2016 13:45:09 +0100 (CET)
Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by submithost.informatik.uni-bremen.de (Postfix) with ESMTPSA id 3tjcv9490pz8N4Y for <core@ietf.org>; Tue, 20 Dec 2016 13:45:09 +0100 (CET)
Received: by mail-wm0-f42.google.com with SMTP id f82so129418023wmf.1 for <core@ietf.org>; Tue, 20 Dec 2016 04:45:09 -0800 (PST)
X-Gm-Message-State: AIkVDXL+zUP+BynxxIfzoswYaEyj1PF2vWjS9VAmewkO3X+fqjDvdDWOe36Zb5bPW7fqGUoN6L3jLT6WATom0w==
X-Received: by 10.28.45.142 with SMTP id t136mr1947288wmt.110.1482237909254; Tue, 20 Dec 2016 04:45:09 -0800 (PST)
MIME-Version: 1.0
Received: by 10.194.16.38 with HTTP; Tue, 20 Dec 2016 04:44:23 -0800 (PST)
In-Reply-To: <f16b6c637b464821b12795c3c83b3483@HE1PR9001MB0170.MGDPHG.emi.philips.com>
References: <f16b6c637b464821b12795c3c83b3483@HE1PR9001MB0170.MGDPHG.emi.philips.com>
From: Klaus Hartke <hartke@tzi.org>
Date: Tue, 20 Dec 2016 13:44:23 +0100
X-Gmail-Original-Message-ID: <CAAzbHvYb=tuX-s_+5YQ3GfT0QvjnZDkGanepU7J7HStxNUiv9A@mail.gmail.com>
Message-ID: <CAAzbHvYb=tuX-s_+5YQ3GfT0QvjnZDkGanepU7J7HStxNUiv9A@mail.gmail.com>
To: "Dijk, Esko" <esko.dijk@philips.com>
Content-Type: text/plain; charset="UTF-8"
Archived-At: <https://mailarchive.ietf.org/arch/msg/core/vqOiUreodGXqWZGeGOTREChCsKY>
Cc: "core (core@ietf.org)" <core@ietf.org>
Subject: Re: [core] CoAP's handling of trailing slash in URI - to file erratum?
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.17
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: <https://mailarchive.ietf.org/arch/browse/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, 20 Dec 2016 12:45:18 -0000

Esko Dijk wrote:
> one would like to encode the below two CoAP URIs as separate CoAP requests
> because the two are in principle semantically different:
>
>   Example #1:  coap://host.example.com/path
>   Example #2:  coap://host.example.com/path/
> [...]
> The Example #1 URI will be encoded with a single Uri-Path option containing
> 4 bytes "path".
>
> The #2 URI should be encoded with two Uri-Path options, one containing
> "path" and a second one of zero bytes.

This is the correct behavior.

Section 3.3 of RFC 3986 [1] defines the path component of a URI as a
sequence of (possibly empty) segments separated by a slash character:

      path-abempty  = *( "/" segment )
      path-absolute = "/" [ segment-nz *( "/" segment ) ]
      path-noscheme = segment-nz-nc *( "/" segment )
      path-rootless = segment-nz *( "/" segment )
      path-empty    = 0<pchar>

As the ABNF shows, there are two segments in Example #2 ("path" and
"") and segments do not include the slash character. RFC 7252 Section
6.4 step 8 tries to make that double clear by saying "let that
option's value be the segment (not including the delimiting slash
characters)".

So I don't think that RFC 7252 is wrong. Of course, there is always
room for improvement of the text.

Klaus

[1] https://tools.ietf.org/html/rfc3986#section-3.3