From e813f41478eefb50748e9bdc2b825fa8bc25c971 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 9 May 2012 20:52:54 +0100 Subject: Escape and unescape xml element names if necessary in ServerUtils.BuildXmlData() and ParseElement() If AvatarService appearance data is retrieved over the network, then ServerUtils was attempting to transfer names such as "Wearable 0:0" directly to xml element names, resulting in an exception. Space is not valid in xml element names. Neither is : in this case since the intention is not to namespace. Using names directly as keys is not a good idea. To get around this problem this patch escapes and unescapes the element names as appropriate. This has no impact on existing xml (since it had to be valid in the first place) but allows AvatarService data to be used over the network. Setting appearance (from simulator to AvatarService) did not suffer this problem since the values are passed in the query string which is already properly escaped. --- OpenSim/Server/Base/ServerUtils.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server/Base/ServerUtils.cs') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 0cc2a4b..42c82cf 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -268,7 +268,7 @@ namespace OpenSim.Server.Base continue; XmlElement elem = parent.OwnerDocument.CreateElement("", - kvp.Key, ""); + XmlConvert.EncodeLocalName(kvp.Key), ""); if (kvp.Value is Dictionary) { @@ -323,11 +323,11 @@ namespace OpenSim.Server.Base XmlNode type = part.Attributes.GetNamedItem("type"); if (type == null || type.Value != "List") { - ret[part.Name] = part.InnerText; + ret[XmlConvert.DecodeName(part.Name)] = part.InnerText; } else { - ret[part.Name] = ParseElement(part); + ret[XmlConvert.DecodeName(part.Name)] = ParseElement(part); } } -- cgit v1.1