Subject: [Simple] XCAP: Hex-encoding doubt

From: Iñaki Baz Castillo <[email-masked]>
Date: Tue, 24 Nov 2009 12:43:32 +0100

Hi, I'm trying to understand how exactly a XCAP client must encode the request 
URI according to RFC 4825 and RFC 3986.

For example, in RFC 4825 (XCAP) section 7.7 there is a PUT example:

   PUT
   /rls-services/users/sip:[email-masked]/index/~~/rls-services/
   service%5b@uri=%22sip:[email-masked]%22%5d
   HTTP/1.1

I would like to understand why "@" and ":" are not hex-escaped. As you can 
read below (RFC 3986):

  gen-delims  = ":" / "/" / "?" / "#" / "[" / "]" / "@"

So if "[" and "]" are clearly hex-escaped in the example PUT URI why "@" and 
":" are not hex-escaped?

Also, I would like to know how a client should escape the following URI (note 
the SIP URI param ";myparam=abc"):

   /rls-services/users/sip:[email-masked]/index/~~/rls-services/
   service[@uri="sip:[email-masked];myparam=abc"]

Should the ";" be encoded?

Thanks a lot.

------------------------------------------------------------
http://tools.ietf.org/html/rfc3986#section-2.2

 2.2.  Reserved Characters

   URIs include components and subcomponents that are delimited by
   characters in the "reserved" set.  These characters are called
   "reserved" because they may (or may not) be defined as delimiters by
   the generic syntax, by each scheme-specific syntax, or by the
   implementation-specific syntax of a URI's dereferencing algorithm.
   If data for a URI component would conflict with a reserved
   character's purpose as a delimiter, then the conflicting data must be
   percent-encoded before the URI is formed.

      reserved    = gen-delims / sub-delims

      gen-delims  = ":" / "/" / "?" / "#" / "[" / "]" / "@"

      sub-delims  = "!" / "$" / "&" / "'" / "(" / ")"
                  / "*" / "+" / "," / ";" / "="

   The purpose of reserved characters is to provide a set of delimiting
   characters that are distinguishable from other data within a URI.
   URIs that differ in the replacement of a reserved character with its
   corresponding percent-encoded octet are not equivalent.  Percent-
   encoding a reserved character, or decoding a percent-encoded octet
   that corresponds to a reserved character, will change how the URI is
   interpreted by most applications.

http://tools.ietf.org/html/rfc3986#section-2.3

 2.3.  Unreserved Characters
 
   Characters that are allowed in a URI but do not have a reserved
   purpose are called unreserved.  These include uppercase and lowercase
   letters, decimal digits, hyphen, period, underscore, and tilde.

      unreserved  = ALPHA / DIGIT / "-" / "." / "_" / "~"

   URIs that differ in the replacement of an unreserved character with
   its corresponding percent-encoded US-ASCII octet are equivalent: they
   identify the same resource.  However, URI comparison implementations
   do not always perform normalization prior to comparison (see Section
   6).  For consistency, percent-encoded octets in the ranges of ALPHA
   (%41-%5A and %61-%7A), DIGIT (%30-%39), hyphen (%2D), period (%2E),
   underscore (%5F), or tilde (%7E) should not be created by URI
   producers and, when found in a URI, should be decoded to their
   corresponding unreserved characters by URI normalizers.

------------------------------------------------------------

-- 
Iñaki Baz Castillo <[email-masked]>

---

From: Iñaki Baz Castillo <[email-masked]>
Date: Tue, 24 Nov 2009 14:05:13 +0100

El Martes, 24 de Noviembre de 2009, Iñaki Baz Castillo escribió:

> Also, I would like to know how a client should escape the following URI
>  (note the SIP URI param ";myparam=abc"):
> 

I think ";" should be encoded. At least, I'm testing with a HTTP server and it 
cuts from path everything after ";".

---

From: Eduardo Martins <[email-masked]>
Date: Tue, 24 Nov 2009 14:11:12 +0000

Look at RFC 3896 Appendix A, the ":" , "@" and any sub-delims are permitted
in path segments.

-- Eduardo

http://emmartins.blogspot.com

On Tue, Nov 24, 2009 at 1:05 PM, Iñaki Baz Castillo <[email-masked]> wrote:

> >    /rls-services/users/sip:[email-masked]/index/~~/rls-services/<http://sip:[email-masked]/index/%7E%7E/rls-services/>
> >    service[@uri="sip:[email-masked]<[email-masked]>
> ;myparam=abc"]
> >
> _______________________________________________
> Simple mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/simple
>

---

From: Iñaki Baz Castillo <[email-masked]>
Date: Tue, 24 Nov 2009 15:17:28 +0100

El Martes, 24 de Noviembre de 2009, Iñaki Baz Castillo escribió:
> I think ";" should be encoded. At least, I'm testing with a HTTP server and
>  it cuts from path everything after ";".

A new related question would be:

Is it allowed to use &quot; rather than " ?:

(after hex-unescaping):

  cp:ruleset/cp:rule[@id="pres_whitelist"]/cp:conditions/cp:identity/cp:one[@id=&quot;sip:[email-masked]&quot;]
rather than:
  cp:ruleset/cp:rule[@id="pres_whitelist"]/cp:conditions/cp:identity/cp:one[@id="sip:[email-masked]"]

I've read about it but not sure if it's 100% "standard" and allowed.

Thanks.

---

From: Iñaki Baz Castillo <[email-masked]>
Date: Tue, 24 Nov 2009 15:49:55 +0100

> Look at RFC 3896 Appendix A, the ":" , "@" and any sub-delims are permitted

You are right:

  pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"

Thanks a lot.

---

From: Jari Urpalainen <[email-masked]>
Date: Wed, 25 Nov 2009 11:24:27 +0200

> I've read about it but not sure if it's 100% "standard" and allowed.
No, from xml 1.0:

[10]   AttValue   ::=   '"' ([^<&"] | Reference)* '"' |  "'" ([^<&'] |
Reference)* "'"

So my hint is to use the apostrophe "'" character instead (sub-delim in
rfc3986), no need to percent-escape (though i wouldn't be surprised if
there were buggy implementations). 

br, Jari

---

From: Iñaki Baz Castillo <[email-masked]>
Date: Wed, 25 Nov 2009 10:49:44 +0100

Thanks a lot.

-- 
Iñaki Baz Castillo
<[email-masked]>