[Home]

Summary:ASTERISK-09893: HTTP manager delivery invalid XML
Reporter:Marcos Jose Setim (msetim)Labels:
Date Opened:2007-07-17 14:04:03Date Closed:2007-11-23 11:54:36.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/HTTP
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20070925__bug10220.diff.txt
( 1) 20071122__bug10220.diff.txt
( 2) nowXMLisValid.txt
( 3) nowXMLisValid2.txt
( 4) xmlinvalid.txt
Description:Hi guys,

I'm using the mxml from http manager and it's give a XML Invalid always that a new event is throwing always that some agent leave a queue.

Command: http://127.0.0.1/asterisk/mxml?action=waitevent&_=
Error: attribute duplicate

Attribute "variable" is being duplicate many times.

Thanks
Comments:By: Russell Bryant (russell) 2007-07-17 14:17:55

This is not a crash ... downgrading to minor

By: Jason Parker (jparker) 2007-07-17 14:36:06

Technically this is correct, you aren't allowed(supposed..) to have duplicate attributes.  The fix would require giving each "Variable: " line in vars2manager a unique name somehow.

By: Marcos Jose Setim (msetim) 2007-07-17 15:04:57

I'm using responseXML of Javascript (AJAM) and it's cannot parse this XML. This cause how many problems with my code. In this time I'm making a workaround, removing the duplicate attributes using responseText and then converting string to XML.

I don't believe that be a javascript language problem. I'm not a XML expert but searching on google by "xml duplicate attribute" I found how many threads above same thing using others parsers ( not only javascript xml parser ).

Thanks guys!!! :)

By: Tilghman Lesher (tilghman) 2007-08-31 16:42:21

This patch adds '-2', '-3', '-4', etc onto every duplicate variable name, in an effort to make the XML valid.  Please test this out and see if it works for you.

By: Michiel van Baak (mvanbaak) 2007-09-22 17:54:44

Does this patch fix your problem?
We really need your feedback on this one so we can get it into trunk and possibly 1.4

By: Tilghman Lesher (tilghman) 2007-09-23 22:33:14

Updated patch to current 1.4 SVN.

msetim:  we need your feedback on this, to ensure that this solution fixes the problem displayed by your tools.

By: Brandon Kruse (bkruse) 2007-09-24 21:36:04

Will this break compatibility to the GUI?
-bk

By: Tilghman Lesher (tilghman) 2007-09-24 22:11:45

bkruse:  that's a good question.  Why don't you try it?

By: Marcos Jose Setim (msetim) 2007-09-25 06:35:21

Hi guys,

I'm making a machine to test it. This week I will give the feedback.

By: Denis Galvao (denisgalvao) 2007-09-25 13:49:46

Should this patch be applied on trunk?

On 1.4.11 I got this:
  [CC] manager.c -> manager.o
manager.c:72:30: error: asterisk/astobj2.h: Arquivo ou diretório não encontrado
manager.c: In function â??variable_count_cmp_fnâ??:
manager.c:315: error: â??CMP_MATCHâ?? undeclared (first use in this function)
manager.c:315: error: (Each undeclared identifier is reported only once
manager.c:315: error: for each function it appears in.)
manager.c: In function â??xml_translateâ??:
manager.c:332: warning: implicit declaration of function â??ao2_container_allocâ??
manager.c:332: warning: initialization makes pointer from integer without a cast
manager.c:384: warning: implicit declaration of function â??ao2_findâ??
manager.c:384: warning: assignment makes pointer from integer without a cast
manager.c:388: warning: implicit declaration of function â??ao2_allocâ??
manager.c:388: warning: assignment makes pointer from integer without a cast
manager.c:392: warning: implicit declaration of function â??ao2_refâ??
manager.c:393: warning: implicit declaration of function â??ao2_linkâ??
make[1]: ** [manager.o] Erro 1
make: ** [main] Erro 2

By: Daniel Kühl Lima (dklima) 2007-10-23 14:41:22

I have the same problem.
Any information?
In which version can I apply this patch?

By: Tilghman Lesher (tilghman) 2007-10-24 22:55:37

A test patch worked fine on the current SVN, so SVN from anytime since September 25th up until now should work fine.

By: Tilghman Lesher (tilghman) 2007-11-12 13:40:40.000-0600

Ping.  Anybody tested this to their satisfaction yet?

By: Daniel Kühl Lima (dklima) 2007-11-21 14:06:57.000-0600

I sucessfuly compiled with 1.4.14.
Tomorrow I'll be testing and posting the results here.

Thanks.

By: Marcos Jose Setim (msetim) 2007-11-22 12:53:01.000-0600

Hi,

I've tested the asterisk compiled by dklima and it works!!!

Javascript parser don't throw any error when an agent leave a queue. I'm posting my xmlvalid.txt

Corydon76,

Yes! Now the variables is going with \-([0-9])+ prefix for each one:)

Now can I get my Karma to 0 :-P?

Thanks guys

By: Daniel Kühl Lima (dklima) 2007-11-22 12:56:41.000-0600

It worked.

I Agree to upgrade the msetim's karma...

Thank you guys.



By: Tilghman Lesher (tilghman) 2007-11-22 13:21:27.000-0600

I see a possible problem, so I'm uploading another patch to try.

By: Marcos Jose Setim (msetim) 2007-11-22 13:26:48.000-0600

What we need to test? What do you mean by "possible problem"?

Thanks ;)

By: Marcos Jose Setim (msetim) 2007-11-22 13:51:04.000-0600

Corydon76,

We've tested and now it's going with correct response.

Attributes event, privilege, callerid and so on is not going with \-([0-9)+ prefix, and the variable attribute is going with it.

One think that I saw is that variable- is not in sequence, it's going with variable="", variable-2="" and so on... variable-1="" I don't saw in response.

I'm posting the new result.

Thanks

By: Tilghman Lesher (tilghman) 2007-11-23 11:10:31.000-0600

msetim:  right, that is intentional.  The first name gets no suffix at all, so it remains intact, if it is unique.  Each additional duplicate name gets a suffix indicating how many there are so far, so "-1" will never get assigned.

By: Digium Subversion (svnbot) 2007-11-23 11:16:01.000-0600

Repository: asterisk
Revision: 89536

U   branches/1.4/main/manager.c

------------------------------------------------------------------------
r89536 | tilghman | 2007-11-23 11:16:01 -0600 (Fri, 23 Nov 2007) | 10 lines

Up until this point, the XML output of the manager has been technically
invalid, due to the repetition of certain parameters in a single event.
This caused various issues for XML parsers, some of which refused to parse
at all, given the invalidity of the rendered XML.  So this commit fixes
the XML output, ensuring that each entity parameter has a unique name, thus
ensuring valid XML.
Reported by: msetim
Patch by: tilghman
(Closes issue ASTERISK-9893)

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

By: Digium Subversion (svnbot) 2007-11-23 11:54:36.000-0600

Repository: asterisk
Revision: 89537

_U  trunk/
U   trunk/main/manager.c

------------------------------------------------------------------------
r89537 | tilghman | 2007-11-23 11:54:36 -0600 (Fri, 23 Nov 2007) | 18 lines

Merged revisions 89536 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r89536 | tilghman | 2007-11-23 11:18:26 -0600 (Fri, 23 Nov 2007) | 10 lines

Up until this point, the XML output of the manager has been technically
invalid, due to the repetition of certain parameters in a single event.
This caused various issues for XML parsers, some of which refused to parse
at all, given the invalidity of the rendered XML.  So this commit fixes
the XML output, ensuring that each entity parameter has a unique name, thus
ensuring valid XML.
Reported by: msetim
Patch by: tilghman
(Closes issue ASTERISK-9893)

........

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