p2p payload content change with escaped characters (#3)
Closed
Artur Hefczyc opened 1 decade ago
Due Date
2015-06-29

During Your visit here we talked about that problem with escaped characters. We couldn’t reproduce it then.

Now when investigating the problem in our side I’m not sure anymore where the problem is.

Test data:

<&quot;&amp;&gt;&lt;foo>;'

With original Tigase’s XMLUtils results to:

<"&amp;><foo>;'

in receiving end.

Tigase logs:

2011-01-26 10:07:05  XMPPIOService.processWaitingPackets()  FINEST: 127.0.0.1_5277_127.0.0.1_1632, type: accept, Socket: TLS: Socket[addr=/127.0.0.1,port=1632,localport=5277], Sending packet: from=null, to=null, DATA=<message to="receiver-service.omb.ovi.com" type="headline" from="omb.ovi.com" id="636-1"><event xmlns:mb="http://ovi.com/protocols/mb" xmlns="http://jabber.org/protocol/pubsub#event"><items node="/receiver-service.omb.ovi.com" mb:tomod="toMod" mb:toapp="setter" mb:fromapp="com.myservice" mb:frommod="moduleId"><item publisher="sender-service.omb.ovi.com" timestamp="2011-01-26T08:07:05.760Z"><mb:payload ctype="String">&lt;&quot;&amp;amp;&gt;&lt;foo&gt;;&apos;</mb:payload></item></items></event></message>, SIZE=507, XMLNS=null, PRIORITY=NORMAL, PERMISSION=NONE
 
2011-01-26 10:07:05  XMPPIOService.processWaitingPackets()  FINEST: 127.0.0.1_5277_127.0.0.1_1632, type: accept, Socket: TLS: Socket[addr=/127.0.0.1,port=1632,localport=5277], SENT: <message to="receiver-service.omb.ovi.com" type="headline" from="omb.ovi.com" id="636-1"><event xmlns:mb="http://ovi.com/protocols/mb" xmlns="http://jabber.org/protocol/pubsub#event"><items node="/receiver-service.omb.ovi.com" mb:tomod="toMod" mb:toapp="setter" mb:fromapp="com.myservice" mb:frommod="moduleId"><item publisher="sender-service.omb.ovi.com" timestamp="2011-01-26T08:07:05.760Z"><mb:payload ctype="String">&lt;&quot;&amp;amp;&gt;&lt;foo&gt;;&apos;</mb:payload></item></items></event></message>

But when I alter XMLUtils unescape method to:

    private static final String[] decoded = { "&", "<", ">", "\"", "\'" };
    private static final String[] encoded = {
            "&amp;", "&lt;", "&gt;", "&quot;", "&apos;"
        };
    private static final String[] decodedWOAmp = { "<", ">", "\"", "\'" };
    private static final String[] encodedWOAmp = {
            "&lt;", "&gt;", "&quot;", "&apos;"
        };
 
    public static String unescape(String input) {
        String[] encodedAmp = {"&amp;"};
        String[] decodedAmp = {"&"};
        input = translateAll(input, encodedWOAmp, decodedWOAmp);
        return translateAll(input, encodedAmp, decodedAmp);
    }

Receiving end gets payload:

<&quot;&amp;&gt;&lt;foo>;'

Tigase logs:

2011-01-26 10:18:19  XMPPIOService.processWaitingPackets()  FINEST: 127.0.0.1_5277_127.0.0.1_1730, type: accept, Socket: TLS: Socket[addr=/127.0.0.1,port=1730,localport=5277], Sending packet: from=null, to=null, DATA=<message type="headline" to="receiver-service.omb.ovi.com" from="omb.ovi.com" id="8-1"><event xmlns:mb="http://ovi.com/protocols/mb" xmlns="http://jabber.org/protocol/pubsub#event"><items node="/receiver-service.omb.ovi.com" mb:tomod="toMod" mb:toapp="setter" mb:fromapp="com.myservice" mb:frommod="moduleId"><item publisher="sender-service.omb.ovi.com" timestamp="2011-01-26T08:18:19.955Z"><mb:payload ctype="String">&lt;&amp;quot;&amp;amp;&amp;gt;&amp;lt;foo&gt;;&apos;</mb:payload></item></items></event></message>, SIZE=517, XMLNS=null, PRIORITY=NORMAL, PERMISSION=NONE
 
2011-01-26 10:18:19  XMPPIOService.processWaitingPackets()  FINEST: 127.0.0.1_5277_127.0.0.1_1730, type: accept, Socket: TLS: Socket[addr=/127.0.0.1,port=1730,localport=5277], SENT: <message type="headline" to="receiver-service.omb.ovi.com" from="omb.ovi.com" id="8-1"><event xmlns:mb="http://ovi.com/protocols/mb" xmlns="http://jabber.org/protocol/pubsub#event"><items node="/receiver-service.omb.ovi.com" mb:tomod="toMod" mb:toapp="setter" mb:fromapp="com.myservice" mb:frommod="moduleId"><item publisher="sender-service.omb.ovi.com" timestamp="2011-01-26T08:18:19.955Z"><mb:payload ctype="String">&lt;&amp;quot;&amp;amp;&amp;gt;&amp;lt;foo&gt;;&apos;</mb:payload></item></items></event></message>

See the difference in payloads? Can you reproduce this with tigase or is this problem in omb even though we can fix it changing XMLUtils code?

Also do You have any developer guide for that cache in Tigase you were talking during visit? That we could use instead of memcached? We would like to investigate that if we could use it.

Artur Hefczyc commented 1 decade ago

I am not sure whether this issue was fixed or not, please check it out.

Andrzej Wójcik (Tigase) commented 1 decade ago

Issue still exists.

before escaping:

<&quot;&amp;&gt;&lt;foo>;'

after escaping:

&lt;&amp;quot;&amp;amp;&amp;gt;&amp;lt;foo&gt;;&apos;

after unescaping:

<"&amp;><foo>;'

should be:

<&quot;&amp;&gt;&lt;foo>;'

& should be replaced at the end of unescaping.

Maybe unescape method should process escaping table in reverse order?

issue 1 of 1
Type
Bug
Priority
Normal
Assignee
RedmineID
242
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/tigase-xmltools#3
Please wait...
Page is in error, reload to recover