bettybop68 / android-rcs-ims-stack

Automatically exported from code.google.com/p/android-rcs-ims-stack
0 stars 1 forks source link

PUBLISHed presence document contains illegal XML #85

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Enable presence such that a PUBLISH is emitted from the client
2.
3.

What is the expected output? What do you see instead?
The presence document contains (I believe) illegal XML that fails XML 
validation.

What version of the product are you using? On what operating system?
2.4.8 (although I think it was introduced as a problem in 2.4.6)

Please provide any additional information below.

Here is an example of the "presence" element that comes out of the client when 
it sends a PUBLISH:

<presence xmlns="urn:ietf:params:xml:ns:pidf" 
xmlns:op="urn:oma:xml:prs:pidf:oma-pres" xmlns:opd="urn:oma:xml:pde:pidf:ext" 
xmlns:pdm="urn:ietf:params:xml:ns:pidf:data-model" 
xmlns:ci="urn:ietf:params:xml:ns:pidf:cipid" 
xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid" 
xmlns:gp="urn:ietf:params:xml:ns:pidf:geopriv10" 
xmlns:gml="urn:opengis:specification:gml:schema-xsd:feature:v3.0" 
entity="<sip:+19025551234@domain.com>">

Because the SIP URI is quoted (<sip:....>) it appears that it is violating 
basic XML rules. For example I ran the full document through an online XML 
validator such as the one found at http://www.xmlvalidation.com/ and it 
complains about the '<'. I think it should either not be a quoted URI, or the < 
and > should be encoded. Personally I don't think the SIP URI needs to be 
quoted in this case.

Original issue reported on code.google.com by iiaGa...@gmail.com on 26 Sep 2012 at 12:47

GoogleCodeExporter commented 8 years ago
Thks for this issue, since we do not test presence a lot today since it is 
optional with RCS-e. I should remove the quotes.

Original comment by jmauffret@gmail.com on 15 Oct 2012 at 6:04

GoogleCodeExporter commented 8 years ago
See the following patch integrated in next release :

    /**
     * Set the user associated URIs
     * 
     * @param uris List of URIs
     */
    public void setAssociatedUri(ListIterator<Header> uris) {
        if (uris == null) {
            return;
        }

        String sipUri = null;
        String telUri = null;
        while(uris.hasNext()) {
            ExtensionHeader header = (ExtensionHeader)uris.next();
            String value = header.getValue();
            value = SipUtils.extractUriFromAddress(value);
            associatedUriList.addElement(value);

            if (value.startsWith("sip:")) {
                sipUri = value;
            } else
            if (value.startsWith("tel:")) {
                telUri = value;
            }
        }

        if ((sipUri != null) && (telUri != null)) {
            preferredUri = telUri;
        } else
        if (telUri != null) {
            preferredUri = telUri;
        } else
        if (sipUri != null) {
            preferredUri = sipUri;
        }
    }

Sorry for the delay.

Original comment by jmauffret@gmail.com on 26 Oct 2012 at 6:25