diff options
author | Sean McNamara | 2011-04-23 18:33:08 -0400 |
---|---|---|
committer | Sean McNamara | 2011-04-23 18:33:08 -0400 |
commit | d287e0ac683acb0cab51bf0dbbc9d1fd08bd6bc9 (patch) | |
tree | 30a24bf66050c66ebe74b68745c4f1764fe09181 /OpenSim/Framework | |
parent | AutoBackup: Removed unneeded imports. (diff) | |
parent | Added MaxAgents configuration option to RegionConfig.ini allowing region host... (diff) | |
download | opensim-SC-d287e0ac683acb0cab51bf0dbbc9d1fd08bd6bc9.zip opensim-SC-d287e0ac683acb0cab51bf0dbbc9d1fd08bd6bc9.tar.gz opensim-SC-d287e0ac683acb0cab51bf0dbbc9d1fd08bd6bc9.tar.bz2 opensim-SC-d287e0ac683acb0cab51bf0dbbc9d1fd08bd6bc9.tar.xz |
Merge git://opensimulator.org/git/opensim
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Console/CommandConsole.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 44 | ||||
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 17 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs | 192 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | 131 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs | 122 | ||||
-rw-r--r-- | OpenSim/Framework/WebUtil.cs | 339 |
8 files changed, 382 insertions, 469 deletions
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index 52bcd55..be36cf2 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs | |||
@@ -592,9 +592,7 @@ namespace OpenSim.Framework.Console | |||
592 | string line = ReadLine(m_defaultPrompt + "# ", true, true); | 592 | string line = ReadLine(m_defaultPrompt + "# ", true, true); |
593 | 593 | ||
594 | if (line != String.Empty) | 594 | if (line != String.Empty) |
595 | { | 595 | Output("Invalid command"); |
596 | m_log.Info("[CONSOLE] Invalid command"); | ||
597 | } | ||
598 | } | 596 | } |
599 | 597 | ||
600 | public void RunCommand(string cmd) | 598 | public void RunCommand(string cmd) |
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 5bf0b7b..f573c32 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -570,16 +570,35 @@ namespace OpenSim.Framework | |||
570 | public float dwell; | 570 | public float dwell; |
571 | } | 571 | } |
572 | 572 | ||
573 | public class EntityUpdate | 573 | public class IEntityUpdate |
574 | { | 574 | { |
575 | public ISceneEntity Entity; | 575 | public ISceneEntity Entity; |
576 | public PrimUpdateFlags Flags; | 576 | public uint Flags; |
577 | public float TimeDilation; | ||
578 | 577 | ||
579 | public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags, float timedilation) | 578 | public virtual void Update(IEntityUpdate update) |
579 | { | ||
580 | this.Flags |= update.Flags; | ||
581 | } | ||
582 | |||
583 | public IEntityUpdate(ISceneEntity entity, uint flags) | ||
580 | { | 584 | { |
581 | Entity = entity; | 585 | Entity = entity; |
582 | Flags = flags; | 586 | Flags = flags; |
587 | } | ||
588 | } | ||
589 | |||
590 | |||
591 | public class EntityUpdate : IEntityUpdate | ||
592 | { | ||
593 | // public ISceneEntity Entity; | ||
594 | // public PrimUpdateFlags Flags; | ||
595 | public float TimeDilation; | ||
596 | |||
597 | public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags, float timedilation) | ||
598 | : base(entity,(uint)flags) | ||
599 | { | ||
600 | //Entity = entity; | ||
601 | // Flags = flags; | ||
583 | TimeDilation = timedilation; | 602 | TimeDilation = timedilation; |
584 | } | 603 | } |
585 | } | 604 | } |
@@ -1211,20 +1230,9 @@ namespace OpenSim.Framework | |||
1211 | /// <param name="stats"></param> | 1230 | /// <param name="stats"></param> |
1212 | void SendSimStats(SimStats stats); | 1231 | void SendSimStats(SimStats stats); |
1213 | 1232 | ||
1214 | void SendObjectPropertiesFamilyData(uint RequestFlags, UUID ObjectUUID, UUID OwnerID, UUID GroupID, | 1233 | void SendObjectPropertiesFamilyData(ISceneEntity Entity, uint RequestFlags); |
1215 | uint BaseMask, uint OwnerMask, uint GroupMask, uint EveryoneMask, | 1234 | |
1216 | uint NextOwnerMask, int OwnershipCost, byte SaleType, int SalePrice, | 1235 | void SendObjectPropertiesReply(ISceneEntity Entity); |
1217 | uint Category, | ||
1218 | UUID LastOwnerID, string ObjectName, string Description); | ||
1219 | |||
1220 | void SendObjectPropertiesReply(UUID ItemID, ulong CreationDate, UUID CreatorUUID, UUID FolderUUID, | ||
1221 | UUID FromTaskUUID, | ||
1222 | UUID GroupUUID, short InventorySerial, UUID LastOwnerUUID, UUID ObjectUUID, | ||
1223 | UUID OwnerUUID, string TouchTitle, byte[] TextureID, string SitTitle, | ||
1224 | string ItemName, | ||
1225 | string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask, | ||
1226 | uint EveryoneMask, | ||
1227 | uint BaseMask, byte saleType, int salePrice); | ||
1228 | 1236 | ||
1229 | void SendAgentOffline(UUID[] agentIDs); | 1237 | void SendAgentOffline(UUID[] agentIDs); |
1230 | 1238 | ||
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index daf0a25..239ce3d 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -369,6 +369,7 @@ namespace OpenSim.Framework | |||
369 | private int m_physPrimMax = 0; | 369 | private int m_physPrimMax = 0; |
370 | private bool m_clampPrimSize = false; | 370 | private bool m_clampPrimSize = false; |
371 | private int m_objectCapacity = 0; | 371 | private int m_objectCapacity = 0; |
372 | private int m_agentCapacity = 0; | ||
372 | private string m_regionType = String.Empty; | 373 | private string m_regionType = String.Empty; |
373 | private RegionLightShareData m_windlight = new RegionLightShareData(); | 374 | private RegionLightShareData m_windlight = new RegionLightShareData(); |
374 | protected uint m_httpPort; | 375 | protected uint m_httpPort; |
@@ -547,6 +548,11 @@ namespace OpenSim.Framework | |||
547 | get { return m_objectCapacity; } | 548 | get { return m_objectCapacity; } |
548 | } | 549 | } |
549 | 550 | ||
551 | public int AgentCapacity | ||
552 | { | ||
553 | get { return m_agentCapacity; } | ||
554 | } | ||
555 | |||
550 | public byte AccessLevel | 556 | public byte AccessLevel |
551 | { | 557 | { |
552 | get { return (byte)Util.ConvertMaturityToAccessLevel((uint)RegionSettings.Maturity); } | 558 | get { return (byte)Util.ConvertMaturityToAccessLevel((uint)RegionSettings.Maturity); } |
@@ -821,6 +827,8 @@ namespace OpenSim.Framework | |||
821 | 827 | ||
822 | m_objectCapacity = config.GetInt("MaxPrims", 15000); | 828 | m_objectCapacity = config.GetInt("MaxPrims", 15000); |
823 | 829 | ||
830 | m_agentCapacity = config.GetInt("MaxAgents", 100); | ||
831 | |||
824 | 832 | ||
825 | // Multi-tenancy | 833 | // Multi-tenancy |
826 | // | 834 | // |
@@ -857,6 +865,9 @@ namespace OpenSim.Framework | |||
857 | if (m_objectCapacity != 0) | 865 | if (m_objectCapacity != 0) |
858 | config.Set("MaxPrims", m_objectCapacity); | 866 | config.Set("MaxPrims", m_objectCapacity); |
859 | 867 | ||
868 | if (m_agentCapacity != 0) | ||
869 | config.Set("MaxAgents", m_agentCapacity); | ||
870 | |||
860 | if (ScopeID != UUID.Zero) | 871 | if (ScopeID != UUID.Zero) |
861 | config.Set("ScopeID", ScopeID.ToString()); | 872 | config.Set("ScopeID", ScopeID.ToString()); |
862 | 873 | ||
@@ -943,6 +954,9 @@ namespace OpenSim.Framework | |||
943 | configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, | 954 | configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, |
944 | "Max objects this sim will hold", m_objectCapacity.ToString(), true); | 955 | "Max objects this sim will hold", m_objectCapacity.ToString(), true); |
945 | 956 | ||
957 | configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, | ||
958 | "Max avatars this sim will hold", m_agentCapacity.ToString(), true); | ||
959 | |||
946 | configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID, | 960 | configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID, |
947 | "Scope ID for this region", ScopeID.ToString(), true); | 961 | "Scope ID for this region", ScopeID.ToString(), true); |
948 | 962 | ||
@@ -1055,6 +1069,9 @@ namespace OpenSim.Framework | |||
1055 | case "object_capacity": | 1069 | case "object_capacity": |
1056 | m_objectCapacity = (int)configuration_result; | 1070 | m_objectCapacity = (int)configuration_result; |
1057 | break; | 1071 | break; |
1072 | case "agent_capacity": | ||
1073 | m_agentCapacity = (int)configuration_result; | ||
1074 | break; | ||
1058 | case "scope_id": | 1075 | case "scope_id": |
1059 | ScopeID = (UUID)configuration_result; | 1076 | ScopeID = (UUID)configuration_result; |
1060 | break; | 1077 | break; |
diff --git a/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs deleted file mode 100644 index 03c12dd..0000000 --- a/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs +++ /dev/null | |||
@@ -1,192 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.IO; | ||
30 | using System.Net; | ||
31 | using System.Reflection; | ||
32 | using System.Text; | ||
33 | using System.Xml; | ||
34 | using System.Xml.Serialization; | ||
35 | using log4net; | ||
36 | |||
37 | namespace OpenSim.Framework.Servers.HttpServer | ||
38 | { | ||
39 | public class AsynchronousRestObjectRequester | ||
40 | { | ||
41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
42 | |||
43 | /// <summary> | ||
44 | /// Perform an asynchronous REST request. | ||
45 | /// </summary> | ||
46 | /// <param name="verb">GET or POST</param> | ||
47 | /// <param name="requestUrl"></param> | ||
48 | /// <param name="obj"></param> | ||
49 | /// <param name="action"></param> | ||
50 | /// <returns></returns> | ||
51 | /// | ||
52 | /// <exception cref="System.Net.WebException">Thrown if we encounter a | ||
53 | /// network issue while posting the request. You'll want to make | ||
54 | /// sure you deal with this as they're not uncommon</exception> | ||
55 | // | ||
56 | public static void MakeRequest<TRequest, TResponse>(string verb, | ||
57 | string requestUrl, TRequest obj, Action<TResponse> action) | ||
58 | { | ||
59 | // m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl); | ||
60 | |||
61 | Type type = typeof (TRequest); | ||
62 | |||
63 | WebRequest request = WebRequest.Create(requestUrl); | ||
64 | WebResponse response = null; | ||
65 | TResponse deserial = default(TResponse); | ||
66 | XmlSerializer deserializer = new XmlSerializer(typeof (TResponse)); | ||
67 | |||
68 | request.Method = verb; | ||
69 | |||
70 | if (verb == "POST") | ||
71 | { | ||
72 | request.ContentType = "text/xml"; | ||
73 | |||
74 | MemoryStream buffer = new MemoryStream(); | ||
75 | |||
76 | XmlWriterSettings settings = new XmlWriterSettings(); | ||
77 | settings.Encoding = Encoding.UTF8; | ||
78 | |||
79 | using (XmlWriter writer = XmlWriter.Create(buffer, settings)) | ||
80 | { | ||
81 | XmlSerializer serializer = new XmlSerializer(type); | ||
82 | serializer.Serialize(writer, obj); | ||
83 | writer.Flush(); | ||
84 | } | ||
85 | |||
86 | int length = (int) buffer.Length; | ||
87 | request.ContentLength = length; | ||
88 | |||
89 | request.BeginGetRequestStream(delegate(IAsyncResult res) | ||
90 | { | ||
91 | Stream requestStream = request.EndGetRequestStream(res); | ||
92 | |||
93 | requestStream.Write(buffer.ToArray(), 0, length); | ||
94 | requestStream.Close(); | ||
95 | |||
96 | request.BeginGetResponse(delegate(IAsyncResult ar) | ||
97 | { | ||
98 | response = request.EndGetResponse(ar); | ||
99 | Stream respStream = null; | ||
100 | try | ||
101 | { | ||
102 | respStream = response.GetResponseStream(); | ||
103 | deserial = (TResponse)deserializer.Deserialize( | ||
104 | respStream); | ||
105 | } | ||
106 | catch (System.InvalidOperationException) | ||
107 | { | ||
108 | } | ||
109 | finally | ||
110 | { | ||
111 | // Let's not close this | ||
112 | //buffer.Close(); | ||
113 | respStream.Close(); | ||
114 | response.Close(); | ||
115 | } | ||
116 | |||
117 | action(deserial); | ||
118 | |||
119 | }, null); | ||
120 | }, null); | ||
121 | |||
122 | |||
123 | return; | ||
124 | } | ||
125 | |||
126 | request.BeginGetResponse(delegate(IAsyncResult res2) | ||
127 | { | ||
128 | try | ||
129 | { | ||
130 | // If the server returns a 404, this appears to trigger a System.Net.WebException even though that isn't | ||
131 | // documented in MSDN | ||
132 | response = request.EndGetResponse(res2); | ||
133 | |||
134 | Stream respStream = null; | ||
135 | try | ||
136 | { | ||
137 | respStream = response.GetResponseStream(); | ||
138 | deserial = (TResponse)deserializer.Deserialize(respStream); | ||
139 | } | ||
140 | catch (System.InvalidOperationException) | ||
141 | { | ||
142 | } | ||
143 | finally | ||
144 | { | ||
145 | respStream.Close(); | ||
146 | response.Close(); | ||
147 | } | ||
148 | } | ||
149 | catch (WebException e) | ||
150 | { | ||
151 | if (e.Status == WebExceptionStatus.ProtocolError) | ||
152 | { | ||
153 | if (e.Response is HttpWebResponse) | ||
154 | { | ||
155 | HttpWebResponse httpResponse = (HttpWebResponse)e.Response; | ||
156 | |||
157 | if (httpResponse.StatusCode != HttpStatusCode.NotFound) | ||
158 | { | ||
159 | // We don't appear to be handling any other status codes, so log these feailures to that | ||
160 | // people don't spend unnecessary hours hunting phantom bugs. | ||
161 | m_log.DebugFormat( | ||
162 | "[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}", | ||
163 | verb, requestUrl, httpResponse.StatusCode); | ||
164 | } | ||
165 | } | ||
166 | } | ||
167 | else | ||
168 | { | ||
169 | m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with status {2} and message {3}", verb, requestUrl, e.Status, e.Message); | ||
170 | } | ||
171 | } | ||
172 | catch (Exception e) | ||
173 | { | ||
174 | m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with exception {2}", verb, requestUrl, e); | ||
175 | } | ||
176 | |||
177 | // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); | ||
178 | |||
179 | try | ||
180 | { | ||
181 | action(deserial); | ||
182 | } | ||
183 | catch (Exception e) | ||
184 | { | ||
185 | m_log.ErrorFormat( | ||
186 | "[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}", verb, requestUrl, e); | ||
187 | } | ||
188 | |||
189 | }, null); | ||
190 | } | ||
191 | } | ||
192 | } | ||
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index ccec9b7..ba89e21 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -430,7 +430,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
430 | string path = request.RawUrl; | 430 | string path = request.RawUrl; |
431 | string handlerKey = GetHandlerKey(request.HttpMethod, path); | 431 | string handlerKey = GetHandlerKey(request.HttpMethod, path); |
432 | 432 | ||
433 | //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); | 433 | // m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); |
434 | 434 | ||
435 | if (TryGetStreamHandler(handlerKey, out requestHandler)) | 435 | if (TryGetStreamHandler(handlerKey, out requestHandler)) |
436 | { | 436 | { |
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs deleted file mode 100644 index 41ece86..0000000 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ /dev/null | |||
@@ -1,131 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.IO; | ||
30 | using System.Net; | ||
31 | using System.Reflection; | ||
32 | using System.Text; | ||
33 | using System.Xml; | ||
34 | using System.Xml.Serialization; | ||
35 | |||
36 | using log4net; | ||
37 | |||
38 | namespace OpenSim.Framework.Servers.HttpServer | ||
39 | { | ||
40 | public class SynchronousRestFormsRequester | ||
41 | { | ||
42 | private static readonly ILog m_log = | ||
43 | LogManager.GetLogger( | ||
44 | MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | |||
46 | /// <summary> | ||
47 | /// Perform a synchronous REST request. | ||
48 | /// </summary> | ||
49 | /// <param name="verb"></param> | ||
50 | /// <param name="requestUrl"></param> | ||
51 | /// <param name="obj"> </param> | ||
52 | /// <returns></returns> | ||
53 | /// | ||
54 | /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting | ||
55 | /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> | ||
56 | public static string MakeRequest(string verb, string requestUrl, string obj) | ||
57 | { | ||
58 | WebRequest request = WebRequest.Create(requestUrl); | ||
59 | request.Method = verb; | ||
60 | string respstring = String.Empty; | ||
61 | |||
62 | using (MemoryStream buffer = new MemoryStream()) | ||
63 | { | ||
64 | if ((verb == "POST") || (verb == "PUT")) | ||
65 | { | ||
66 | request.ContentType = "text/www-form-urlencoded"; | ||
67 | |||
68 | int length = 0; | ||
69 | using (StreamWriter writer = new StreamWriter(buffer)) | ||
70 | { | ||
71 | writer.Write(obj); | ||
72 | writer.Flush(); | ||
73 | } | ||
74 | |||
75 | length = (int)obj.Length; | ||
76 | request.ContentLength = length; | ||
77 | |||
78 | Stream requestStream = null; | ||
79 | try | ||
80 | { | ||
81 | requestStream = request.GetRequestStream(); | ||
82 | requestStream.Write(buffer.ToArray(), 0, length); | ||
83 | } | ||
84 | catch (Exception e) | ||
85 | { | ||
86 | m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); | ||
87 | } | ||
88 | finally | ||
89 | { | ||
90 | if (requestStream != null) | ||
91 | requestStream.Close(); | ||
92 | } | ||
93 | } | ||
94 | |||
95 | try | ||
96 | { | ||
97 | using (WebResponse resp = request.GetResponse()) | ||
98 | { | ||
99 | if (resp.ContentLength != 0) | ||
100 | { | ||
101 | Stream respStream = null; | ||
102 | try | ||
103 | { | ||
104 | respStream = resp.GetResponseStream(); | ||
105 | using (StreamReader reader = new StreamReader(respStream)) | ||
106 | { | ||
107 | respstring = reader.ReadToEnd(); | ||
108 | } | ||
109 | } | ||
110 | catch (Exception e) | ||
111 | { | ||
112 | m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString()); | ||
113 | } | ||
114 | finally | ||
115 | { | ||
116 | if (respStream != null) | ||
117 | respStream.Close(); | ||
118 | } | ||
119 | } | ||
120 | } | ||
121 | } | ||
122 | catch (System.InvalidOperationException) | ||
123 | { | ||
124 | // This is what happens when there is invalid XML | ||
125 | m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); | ||
126 | } | ||
127 | } | ||
128 | return respstring; | ||
129 | } | ||
130 | } | ||
131 | } | ||
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs deleted file mode 100644 index eab463c..0000000 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs +++ /dev/null | |||
@@ -1,122 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.IO; | ||
30 | using System.Net; | ||
31 | using System.Text; | ||
32 | using System.Xml; | ||
33 | using System.Xml.Serialization; | ||
34 | |||
35 | namespace OpenSim.Framework.Servers.HttpServer | ||
36 | { | ||
37 | public class SynchronousRestObjectPoster | ||
38 | { | ||
39 | [Obsolete] | ||
40 | public static TResponse BeginPostObject<TRequest, TResponse>(string verb, string requestUrl, TRequest obj) | ||
41 | { | ||
42 | return SynchronousRestObjectRequester.MakeRequest<TRequest, TResponse>(verb, requestUrl, obj); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | public class SynchronousRestObjectRequester | ||
47 | { | ||
48 | /// <summary> | ||
49 | /// Perform a synchronous REST request. | ||
50 | /// </summary> | ||
51 | /// <param name="verb"></param> | ||
52 | /// <param name="requestUrl"></param> | ||
53 | /// <param name="obj"> </param> | ||
54 | /// <returns></returns> | ||
55 | /// | ||
56 | /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting | ||
57 | /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> | ||
58 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj) | ||
59 | { | ||
60 | Type type = typeof (TRequest); | ||
61 | TResponse deserial = default(TResponse); | ||
62 | |||
63 | WebRequest request = WebRequest.Create(requestUrl); | ||
64 | request.Method = verb; | ||
65 | |||
66 | if ((verb == "POST") || (verb == "PUT")) | ||
67 | { | ||
68 | request.ContentType = "text/xml"; | ||
69 | |||
70 | MemoryStream buffer = new MemoryStream(); | ||
71 | |||
72 | XmlWriterSettings settings = new XmlWriterSettings(); | ||
73 | settings.Encoding = Encoding.UTF8; | ||
74 | |||
75 | using (XmlWriter writer = XmlWriter.Create(buffer, settings)) | ||
76 | { | ||
77 | XmlSerializer serializer = new XmlSerializer(type); | ||
78 | serializer.Serialize(writer, obj); | ||
79 | writer.Flush(); | ||
80 | } | ||
81 | |||
82 | int length = (int) buffer.Length; | ||
83 | request.ContentLength = length; | ||
84 | |||
85 | Stream requestStream = null; | ||
86 | try | ||
87 | { | ||
88 | requestStream = request.GetRequestStream(); | ||
89 | requestStream.Write(buffer.ToArray(), 0, length); | ||
90 | } | ||
91 | catch (Exception) | ||
92 | { | ||
93 | return deserial; | ||
94 | } | ||
95 | finally | ||
96 | { | ||
97 | if (requestStream != null) | ||
98 | requestStream.Close(); | ||
99 | } | ||
100 | } | ||
101 | |||
102 | try | ||
103 | { | ||
104 | using (WebResponse resp = request.GetResponse()) | ||
105 | { | ||
106 | if (resp.ContentLength > 0) | ||
107 | { | ||
108 | Stream respStream = resp.GetResponseStream(); | ||
109 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); | ||
110 | deserial = (TResponse)deserializer.Deserialize(respStream); | ||
111 | respStream.Close(); | ||
112 | } | ||
113 | } | ||
114 | } | ||
115 | catch (System.InvalidOperationException) | ||
116 | { | ||
117 | // This is what happens when there is invalid XML | ||
118 | } | ||
119 | return deserial; | ||
120 | } | ||
121 | } | ||
122 | } | ||
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 1feeeb3..9d70f63 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -36,6 +36,9 @@ using System.Net.Security; | |||
36 | using System.Reflection; | 36 | using System.Reflection; |
37 | using System.Text; | 37 | using System.Text; |
38 | using System.Web; | 38 | using System.Web; |
39 | using System.Xml; | ||
40 | using System.Xml.Serialization; | ||
41 | |||
39 | using log4net; | 42 | using log4net; |
40 | using OpenSim.Framework.Servers.HttpServer; | 43 | using OpenSim.Framework.Servers.HttpServer; |
41 | using OpenMetaverse.StructuredData; | 44 | using OpenMetaverse.StructuredData; |
@@ -219,8 +222,8 @@ namespace OpenSim.Framework | |||
219 | m_log.InfoFormat("[WEB UTIL]: osd request <{0}> (URI:{1}, METHOD:{2}) took {3}ms overall, {4}ms writing", | 222 | m_log.InfoFormat("[WEB UTIL]: osd request <{0}> (URI:{1}, METHOD:{2}) took {3}ms overall, {4}ms writing", |
220 | reqnum,url,method,tickdiff,tickdata); | 223 | reqnum,url,method,tickdiff,tickdata); |
221 | } | 224 | } |
222 | 225 | ||
223 | m_log.WarnFormat("[WEB UTIL] <{0}> osd request failed: {1}",reqnum,errorMessage); | 226 | m_log.WarnFormat("[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage); |
224 | return ErrorResponseMap(errorMessage); | 227 | return ErrorResponseMap(errorMessage); |
225 | } | 228 | } |
226 | 229 | ||
@@ -625,4 +628,336 @@ namespace OpenSim.Framework | |||
625 | 628 | ||
626 | 629 | ||
627 | } | 630 | } |
631 | |||
632 | public static class AsynchronousRestObjectRequester | ||
633 | { | ||
634 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
635 | |||
636 | /// <summary> | ||
637 | /// Perform an asynchronous REST request. | ||
638 | /// </summary> | ||
639 | /// <param name="verb">GET or POST</param> | ||
640 | /// <param name="requestUrl"></param> | ||
641 | /// <param name="obj"></param> | ||
642 | /// <param name="action"></param> | ||
643 | /// <returns></returns> | ||
644 | /// | ||
645 | /// <exception cref="System.Net.WebException">Thrown if we encounter a | ||
646 | /// network issue while posting the request. You'll want to make | ||
647 | /// sure you deal with this as they're not uncommon</exception> | ||
648 | // | ||
649 | public static void MakeRequest<TRequest, TResponse>(string verb, | ||
650 | string requestUrl, TRequest obj, Action<TResponse> action) | ||
651 | { | ||
652 | // m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl); | ||
653 | |||
654 | Type type = typeof(TRequest); | ||
655 | |||
656 | WebRequest request = WebRequest.Create(requestUrl); | ||
657 | WebResponse response = null; | ||
658 | TResponse deserial = default(TResponse); | ||
659 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); | ||
660 | |||
661 | request.Method = verb; | ||
662 | |||
663 | if (verb == "POST") | ||
664 | { | ||
665 | request.ContentType = "text/xml"; | ||
666 | |||
667 | MemoryStream buffer = new MemoryStream(); | ||
668 | |||
669 | XmlWriterSettings settings = new XmlWriterSettings(); | ||
670 | settings.Encoding = Encoding.UTF8; | ||
671 | |||
672 | using (XmlWriter writer = XmlWriter.Create(buffer, settings)) | ||
673 | { | ||
674 | XmlSerializer serializer = new XmlSerializer(type); | ||
675 | serializer.Serialize(writer, obj); | ||
676 | writer.Flush(); | ||
677 | } | ||
678 | |||
679 | int length = (int)buffer.Length; | ||
680 | request.ContentLength = length; | ||
681 | |||
682 | request.BeginGetRequestStream(delegate(IAsyncResult res) | ||
683 | { | ||
684 | Stream requestStream = request.EndGetRequestStream(res); | ||
685 | |||
686 | requestStream.Write(buffer.ToArray(), 0, length); | ||
687 | requestStream.Close(); | ||
688 | |||
689 | request.BeginGetResponse(delegate(IAsyncResult ar) | ||
690 | { | ||
691 | response = request.EndGetResponse(ar); | ||
692 | Stream respStream = null; | ||
693 | try | ||
694 | { | ||
695 | respStream = response.GetResponseStream(); | ||
696 | deserial = (TResponse)deserializer.Deserialize( | ||
697 | respStream); | ||
698 | } | ||
699 | catch (System.InvalidOperationException) | ||
700 | { | ||
701 | } | ||
702 | finally | ||
703 | { | ||
704 | // Let's not close this | ||
705 | //buffer.Close(); | ||
706 | respStream.Close(); | ||
707 | response.Close(); | ||
708 | } | ||
709 | |||
710 | action(deserial); | ||
711 | |||
712 | }, null); | ||
713 | }, null); | ||
714 | |||
715 | |||
716 | return; | ||
717 | } | ||
718 | |||
719 | request.BeginGetResponse(delegate(IAsyncResult res2) | ||
720 | { | ||
721 | try | ||
722 | { | ||
723 | // If the server returns a 404, this appears to trigger a System.Net.WebException even though that isn't | ||
724 | // documented in MSDN | ||
725 | response = request.EndGetResponse(res2); | ||
726 | |||
727 | Stream respStream = null; | ||
728 | try | ||
729 | { | ||
730 | respStream = response.GetResponseStream(); | ||
731 | deserial = (TResponse)deserializer.Deserialize(respStream); | ||
732 | } | ||
733 | catch (System.InvalidOperationException) | ||
734 | { | ||
735 | } | ||
736 | finally | ||
737 | { | ||
738 | respStream.Close(); | ||
739 | response.Close(); | ||
740 | } | ||
741 | } | ||
742 | catch (WebException e) | ||
743 | { | ||
744 | if (e.Status == WebExceptionStatus.ProtocolError) | ||
745 | { | ||
746 | if (e.Response is HttpWebResponse) | ||
747 | { | ||
748 | HttpWebResponse httpResponse = (HttpWebResponse)e.Response; | ||
749 | |||
750 | if (httpResponse.StatusCode != HttpStatusCode.NotFound) | ||
751 | { | ||
752 | // We don't appear to be handling any other status codes, so log these feailures to that | ||
753 | // people don't spend unnecessary hours hunting phantom bugs. | ||
754 | m_log.DebugFormat( | ||
755 | "[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}", | ||
756 | verb, requestUrl, httpResponse.StatusCode); | ||
757 | } | ||
758 | } | ||
759 | } | ||
760 | else | ||
761 | { | ||
762 | m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with status {2} and message {3}", verb, requestUrl, e.Status, e.Message); | ||
763 | } | ||
764 | } | ||
765 | catch (Exception e) | ||
766 | { | ||
767 | m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with exception {2}", verb, requestUrl, e); | ||
768 | } | ||
769 | |||
770 | // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); | ||
771 | |||
772 | try | ||
773 | { | ||
774 | action(deserial); | ||
775 | } | ||
776 | catch (Exception e) | ||
777 | { | ||
778 | m_log.ErrorFormat( | ||
779 | "[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}", verb, requestUrl, e); | ||
780 | } | ||
781 | |||
782 | }, null); | ||
783 | } | ||
784 | } | ||
785 | |||
786 | public static class SynchronousRestFormsRequester | ||
787 | { | ||
788 | private static readonly ILog m_log = | ||
789 | LogManager.GetLogger( | ||
790 | MethodBase.GetCurrentMethod().DeclaringType); | ||
791 | |||
792 | /// <summary> | ||
793 | /// Perform a synchronous REST request. | ||
794 | /// </summary> | ||
795 | /// <param name="verb"></param> | ||
796 | /// <param name="requestUrl"></param> | ||
797 | /// <param name="obj"> </param> | ||
798 | /// <returns></returns> | ||
799 | /// | ||
800 | /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting | ||
801 | /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> | ||
802 | public static string MakeRequest(string verb, string requestUrl, string obj) | ||
803 | { | ||
804 | WebRequest request = WebRequest.Create(requestUrl); | ||
805 | request.Method = verb; | ||
806 | string respstring = String.Empty; | ||
807 | |||
808 | using (MemoryStream buffer = new MemoryStream()) | ||
809 | { | ||
810 | if ((verb == "POST") || (verb == "PUT")) | ||
811 | { | ||
812 | request.ContentType = "text/www-form-urlencoded"; | ||
813 | |||
814 | int length = 0; | ||
815 | using (StreamWriter writer = new StreamWriter(buffer)) | ||
816 | { | ||
817 | writer.Write(obj); | ||
818 | writer.Flush(); | ||
819 | } | ||
820 | |||
821 | length = (int)obj.Length; | ||
822 | request.ContentLength = length; | ||
823 | |||
824 | Stream requestStream = null; | ||
825 | try | ||
826 | { | ||
827 | requestStream = request.GetRequestStream(); | ||
828 | requestStream.Write(buffer.ToArray(), 0, length); | ||
829 | } | ||
830 | catch (Exception e) | ||
831 | { | ||
832 | m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); | ||
833 | } | ||
834 | finally | ||
835 | { | ||
836 | if (requestStream != null) | ||
837 | requestStream.Close(); | ||
838 | } | ||
839 | } | ||
840 | |||
841 | try | ||
842 | { | ||
843 | using (WebResponse resp = request.GetResponse()) | ||
844 | { | ||
845 | if (resp.ContentLength != 0) | ||
846 | { | ||
847 | Stream respStream = null; | ||
848 | try | ||
849 | { | ||
850 | respStream = resp.GetResponseStream(); | ||
851 | using (StreamReader reader = new StreamReader(respStream)) | ||
852 | { | ||
853 | respstring = reader.ReadToEnd(); | ||
854 | } | ||
855 | } | ||
856 | catch (Exception e) | ||
857 | { | ||
858 | m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString()); | ||
859 | } | ||
860 | finally | ||
861 | { | ||
862 | if (respStream != null) | ||
863 | respStream.Close(); | ||
864 | } | ||
865 | } | ||
866 | } | ||
867 | } | ||
868 | catch (System.InvalidOperationException) | ||
869 | { | ||
870 | // This is what happens when there is invalid XML | ||
871 | m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); | ||
872 | } | ||
873 | } | ||
874 | return respstring; | ||
875 | } | ||
876 | } | ||
877 | |||
878 | public class SynchronousRestObjectPoster | ||
879 | { | ||
880 | [Obsolete] | ||
881 | public static TResponse BeginPostObject<TRequest, TResponse>(string verb, string requestUrl, TRequest obj) | ||
882 | { | ||
883 | return SynchronousRestObjectRequester.MakeRequest<TRequest, TResponse>(verb, requestUrl, obj); | ||
884 | } | ||
885 | } | ||
886 | |||
887 | public class SynchronousRestObjectRequester | ||
888 | { | ||
889 | /// <summary> | ||
890 | /// Perform a synchronous REST request. | ||
891 | /// </summary> | ||
892 | /// <param name="verb"></param> | ||
893 | /// <param name="requestUrl"></param> | ||
894 | /// <param name="obj"> </param> | ||
895 | /// <returns></returns> | ||
896 | /// | ||
897 | /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting | ||
898 | /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> | ||
899 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj) | ||
900 | { | ||
901 | Type type = typeof(TRequest); | ||
902 | TResponse deserial = default(TResponse); | ||
903 | |||
904 | WebRequest request = WebRequest.Create(requestUrl); | ||
905 | request.Method = verb; | ||
906 | |||
907 | if ((verb == "POST") || (verb == "PUT")) | ||
908 | { | ||
909 | request.ContentType = "text/xml"; | ||
910 | |||
911 | MemoryStream buffer = new MemoryStream(); | ||
912 | |||
913 | XmlWriterSettings settings = new XmlWriterSettings(); | ||
914 | settings.Encoding = Encoding.UTF8; | ||
915 | |||
916 | using (XmlWriter writer = XmlWriter.Create(buffer, settings)) | ||
917 | { | ||
918 | XmlSerializer serializer = new XmlSerializer(type); | ||
919 | serializer.Serialize(writer, obj); | ||
920 | writer.Flush(); | ||
921 | } | ||
922 | |||
923 | int length = (int)buffer.Length; | ||
924 | request.ContentLength = length; | ||
925 | |||
926 | Stream requestStream = null; | ||
927 | try | ||
928 | { | ||
929 | requestStream = request.GetRequestStream(); | ||
930 | requestStream.Write(buffer.ToArray(), 0, length); | ||
931 | } | ||
932 | catch (Exception) | ||
933 | { | ||
934 | return deserial; | ||
935 | } | ||
936 | finally | ||
937 | { | ||
938 | if (requestStream != null) | ||
939 | requestStream.Close(); | ||
940 | } | ||
941 | } | ||
942 | |||
943 | try | ||
944 | { | ||
945 | using (WebResponse resp = request.GetResponse()) | ||
946 | { | ||
947 | if (resp.ContentLength > 0) | ||
948 | { | ||
949 | Stream respStream = resp.GetResponseStream(); | ||
950 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); | ||
951 | deserial = (TResponse)deserializer.Deserialize(respStream); | ||
952 | respStream.Close(); | ||
953 | } | ||
954 | } | ||
955 | } | ||
956 | catch (System.InvalidOperationException) | ||
957 | { | ||
958 | // This is what happens when there is invalid XML | ||
959 | } | ||
960 | return deserial; | ||
961 | } | ||
962 | } | ||
628 | } | 963 | } |