From 134d4300f0b6e9b0df0326cfe0b5df9f41f42865 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Mon, 31 Aug 2015 13:02:51 -0700
Subject: All physics plugins are now region modules. Compiles but doesn't run.
---
OpenSim/Framework/LogWriter.cs | 181 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 181 insertions(+)
create mode 100755 OpenSim/Framework/LogWriter.cs
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/LogWriter.cs b/OpenSim/Framework/LogWriter.cs
new file mode 100755
index 0000000..2e0bf4a
--- /dev/null
+++ b/OpenSim/Framework/LogWriter.cs
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.IO;
+using System.Text;
+using log4net;
+
+namespace OpenSim.Framework
+{
+ ///
+ /// Class for writing a high performance, high volume log file.
+ /// Sometimes, to debug, one has a high volume logging to do and the regular
+ /// log file output is not appropriate.
+ /// Create a new instance with the parameters needed and
+ /// call Write() to output a line. Call Close() when finished.
+ /// If created with no parameters, it will not log anything.
+ ///
+ public class LogWriter : IDisposable
+ {
+ public bool Enabled { get; private set; }
+
+ private string m_logDirectory = ".";
+ private int m_logMaxFileTimeMin = 5; // 5 minutes
+ public String LogFileHeader { get; set; }
+
+ private StreamWriter m_logFile = null;
+ private TimeSpan m_logFileLife;
+ private DateTime m_logFileEndTime;
+ private Object m_logFileWriteLock = new Object();
+ private bool m_flushWrite;
+
+ // set externally when debugging. If let 'null', this does not write any error messages.
+ public ILog ErrorLogger = null;
+ private string LogHeader = "[LOG WRITER]";
+
+ ///
+ /// Create a log writer that will not write anything. Good for when not enabled
+ /// but the write statements are still in the code.
+ ///
+ public LogWriter()
+ {
+ Enabled = false;
+ m_logFile = null;
+ }
+
+ ///
+ /// Create a log writer instance.
+ ///
+ /// The directory to create the log file in. May be 'null' for default.
+ /// The characters that begin the log file name. May be 'null' for default.
+ /// Maximum age of a log file in minutes. If zero, will set default.
+ /// Whether to do a flush after every log write. Best left off but
+ /// if one is looking for a crash, this is a good thing to turn on.
+ public LogWriter(string dir, string headr, int maxFileTime, bool flushWrite)
+ {
+ m_logDirectory = dir == null ? "." : dir;
+
+ LogFileHeader = headr == null ? "log-" : headr;
+
+ m_logMaxFileTimeMin = maxFileTime;
+ if (m_logMaxFileTimeMin < 1)
+ m_logMaxFileTimeMin = 5;
+
+ m_logFileLife = new TimeSpan(0, m_logMaxFileTimeMin, 0);
+ m_logFileEndTime = DateTime.Now + m_logFileLife;
+
+ m_flushWrite = flushWrite;
+
+ Enabled = true;
+ }
+ // Constructor that assumes flushWrite is off.
+ public LogWriter(string dir, string headr, int maxFileTime) : this(dir, headr, maxFileTime, false)
+ {
+ }
+
+ public void Dispose()
+ {
+ this.Close();
+ }
+
+ public void Close()
+ {
+ Enabled = false;
+ if (m_logFile != null)
+ {
+ m_logFile.Close();
+ m_logFile.Dispose();
+ m_logFile = null;
+ }
+ }
+
+ public void Write(string line, params object[] args)
+ {
+ if (!Enabled) return;
+ Write(String.Format(line, args));
+ }
+
+ public void Flush()
+ {
+ if (!Enabled) return;
+ if (m_logFile != null)
+ {
+ m_logFile.Flush();
+ }
+ }
+
+ public void Write(string line)
+ {
+ if (!Enabled) return;
+ try
+ {
+ lock (m_logFileWriteLock)
+ {
+ DateTime now = DateTime.UtcNow;
+ if (m_logFile == null || now > m_logFileEndTime)
+ {
+ if (m_logFile != null)
+ {
+ m_logFile.Close();
+ m_logFile.Dispose();
+ m_logFile = null;
+ }
+
+ // First log file or time has expired, start writing to a new log file
+ m_logFileEndTime = now + m_logFileLife;
+ string path = (m_logDirectory.Length > 0 ? m_logDirectory
+ + System.IO.Path.DirectorySeparatorChar.ToString() : "")
+ + String.Format("{0}{1}.log", LogFileHeader, now.ToString("yyyyMMddHHmmss"));
+ m_logFile = new StreamWriter(File.Open(path, FileMode.Append, FileAccess.Write, FileShare.ReadWrite));
+ }
+ if (m_logFile != null)
+ {
+ StringBuilder buff = new StringBuilder(line.Length + 25);
+ buff.Append(now.ToString("yyyyMMddHHmmssfff"));
+ // buff.Append(now.ToString("yyyyMMddHHmmss"));
+ buff.Append(",");
+ buff.Append(line);
+ buff.Append("\r\n");
+ m_logFile.Write(buff.ToString());
+ if (m_flushWrite)
+ m_logFile.Flush();
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ if (ErrorLogger != null)
+ {
+ ErrorLogger.ErrorFormat("{0}: FAILURE WRITING TO LOGFILE: {1}", LogHeader, e);
+ }
+ Enabled = false;
+ }
+ return;
+ }
+ }
+}
--
cgit v1.1
From 1559fc42b6b4a7510e654773b3d22100ab539de1 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Fri, 4 Sep 2015 13:45:52 -0700
Subject: Deleted unused interface
---
OpenSim/Framework/Communications/IUserService.cs | 157 -----------------------
1 file changed, 157 deletions(-)
delete mode 100644 OpenSim/Framework/Communications/IUserService.cs
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Communications/IUserService.cs b/OpenSim/Framework/Communications/IUserService.cs
deleted file mode 100644
index dfa059d..0000000
--- a/OpenSim/Framework/Communications/IUserService.cs
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Collections.Generic;
-using OpenMetaverse;
-using OpenSim.Services.Interfaces;
-
-namespace OpenSim.Framework.Communications
-{
- public interface IUserService
- {
- ///
- /// Add a temporary user profile.
- ///
- /// A temporary user profile is one that should exist only for the lifetime of the process.
- ///
- void AddTemporaryUserProfile(UserProfileData userProfile);
-
- ///
- /// Loads a user profile by name
- ///
- /// First name
- /// Last name
- /// A user profile. Returns null if no profile is found
- UserProfileData GetUserProfile(string firstName, string lastName);
-
- ///
- /// Loads a user profile from a database by UUID
- ///
- /// The target UUID
- /// A user profile. Returns null if no user profile is found.
- UserProfileData GetUserProfile(UUID userId);
-
- UserProfileData GetUserProfile(Uri uri);
-
- Uri GetUserUri(UserProfileData userProfile);
-
- UserAgentData GetAgentByUUID(UUID userId);
-
- void ClearUserAgent(UUID avatarID);
- List GenerateAgentPickerRequestResponse(UUID QueryID, string Query);
-
- UserProfileData SetupMasterUser(string firstName, string lastName);
- UserProfileData SetupMasterUser(string firstName, string lastName, string password);
- UserProfileData SetupMasterUser(UUID userId);
-
- ///
- /// Update the user's profile.
- ///
- /// UserProfileData object with updated data. Should be obtained
- /// via a call to GetUserProfile().
- /// true if the update could be applied, false if it could not be applied.
- bool UpdateUserProfile(UserProfileData data);
-
- ///
- /// Adds a new friend to the database for XUser
- ///
- /// The agent that who's friends list is being added to
- /// The agent that being added to the friends list of the friends list owner
- /// A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects
- void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms);
-
- ///
- /// Delete friend on friendlistowner's friendlist.
- ///
- /// The agent that who's friends list is being updated
- /// The Ex-friend agent
- void RemoveUserFriend(UUID friendlistowner, UUID friend);
-
- ///
- /// Update permissions for friend on friendlistowner's friendlist.
- ///
- /// The agent that who's friends list is being updated
- /// The agent that is getting or loosing permissions
- /// A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects
- void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms);
-
- ///
- /// Logs off a user on the user server
- ///
- /// UUID of the user
- /// UUID of the Region
- /// regionhandle
- /// final position
- /// final lookat
- void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat);
-
- ///
- /// Logs off a user on the user server (deprecated as of 2008-08-27)
- ///
- /// UUID of the user
- /// UUID of the Region
- /// regionhandle
- /// final position x
- /// final position y
- /// final position z
- void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz);
-
- ///
- /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship
- /// for UUID friendslistowner
- ///
- ///
- /// The agent for whom we're retreiving the friends Data.
- ///
- /// A List of FriendListItems that contains info about the user's friends.
- /// Always returns a list even if the user has no friends
- ///
- List GetUserFriendList(UUID friendlistowner);
-
- // This probably shouldn't be here, it belongs to IAuthentication
- // But since Scenes only have IUserService references, I'm placing it here for now.
- bool VerifySession(UUID userID, UUID sessionID);
-
- ///
- /// Authenticate a user by their password.
- ///
- ///
- /// This is used by callers outside the login process that want to
- /// verify a user who has given their password.
- ///
- /// This should probably also be in IAuthentication but is here for the same reasons as VerifySession() is
- ///
- ///
- ///
- ///
- bool AuthenticateUserByPassword(UUID userID, string password);
-
- // Temporary Hack until we move everything to the new service model
- void SetInventoryService(IInventoryService invService);
- }
-}
--
cgit v1.1
From 9005365115a0c56c4d4827bff67bf8e5e317e5d6 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Fri, 4 Sep 2015 14:14:53 -0700
Subject: Deleted old unfinished code under Framework.Communications that
wasn't being used anywhere. Also folded GenericAsyncResult into RestClient,
since it is used only there. This is preparation to remove
Framework.Communications entirely.
---
.../Framework/Communications/GenericAsyncResult.cs | 185 ---------------------
.../Communications/Limit/IRequestLimitStrategy.cs | 66 --------
.../Communications/Limit/NullLimitStrategy.cs | 40 -----
.../Communications/Limit/RepeatLimitStrategy.cs | 109 ------------
.../Communications/Limit/TimeLimitStrategy.cs | 140 ----------------
OpenSim/Framework/Communications/RestClient.cs | 154 +++++++++++++++++
OpenSim/Framework/Communications/XMPP/XmppError.cs | 39 -----
.../Framework/Communications/XMPP/XmppIqStanza.cs | 60 -------
.../Communications/XMPP/XmppMessageStanza.cs | 93 -----------
.../Communications/XMPP/XmppPresenceStanza.cs | 69 --------
.../Communications/XMPP/XmppSerializer.cs | 79 ---------
.../Framework/Communications/XMPP/XmppStanza.cs | 70 --------
.../Framework/Communications/XMPP/XmppWriter.cs | 57 -------
13 files changed, 154 insertions(+), 1007 deletions(-)
delete mode 100644 OpenSim/Framework/Communications/GenericAsyncResult.cs
delete mode 100644 OpenSim/Framework/Communications/Limit/IRequestLimitStrategy.cs
delete mode 100644 OpenSim/Framework/Communications/Limit/NullLimitStrategy.cs
delete mode 100644 OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs
delete mode 100644 OpenSim/Framework/Communications/Limit/TimeLimitStrategy.cs
delete mode 100644 OpenSim/Framework/Communications/XMPP/XmppError.cs
delete mode 100644 OpenSim/Framework/Communications/XMPP/XmppIqStanza.cs
delete mode 100644 OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs
delete mode 100644 OpenSim/Framework/Communications/XMPP/XmppPresenceStanza.cs
delete mode 100644 OpenSim/Framework/Communications/XMPP/XmppSerializer.cs
delete mode 100644 OpenSim/Framework/Communications/XMPP/XmppStanza.cs
delete mode 100644 OpenSim/Framework/Communications/XMPP/XmppWriter.cs
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Communications/GenericAsyncResult.cs b/OpenSim/Framework/Communications/GenericAsyncResult.cs
deleted file mode 100644
index 8e3f62b..0000000
--- a/OpenSim/Framework/Communications/GenericAsyncResult.cs
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Threading;
-
-namespace OpenSim.Framework.Communications
-{
- internal class SimpleAsyncResult : IAsyncResult
- {
- private readonly AsyncCallback m_callback;
-
- ///
- /// Is process completed?
- ///
- /// Should really be boolean, but VolatileRead has no boolean method
- private byte m_completed;
-
- ///
- /// Did process complete synchronously?
- ///
- /// I have a hard time imagining a scenario where this is the case, again, same issue about
- /// booleans and VolatileRead as m_completed
- ///
- private byte m_completedSynchronously;
-
- private readonly object m_asyncState;
- private ManualResetEvent m_waitHandle;
- private Exception m_exception;
-
- internal SimpleAsyncResult(AsyncCallback cb, object state)
- {
- m_callback = cb;
- m_asyncState = state;
- m_completed = 0;
- m_completedSynchronously = 1;
- }
-
- #region IAsyncResult Members
-
- public object AsyncState
- {
- get { return m_asyncState; }
- }
-
- public WaitHandle AsyncWaitHandle
- {
- get
- {
- if (m_waitHandle == null)
- {
- bool done = IsCompleted;
- ManualResetEvent mre = new ManualResetEvent(done);
- if (Interlocked.CompareExchange(ref m_waitHandle, mre, null) != null)
- {
- mre.Close();
- }
- else
- {
- if (!done && IsCompleted)
- {
- m_waitHandle.Set();
- }
- }
- }
-
- return m_waitHandle;
- }
- }
-
-
- public bool CompletedSynchronously
- {
- get { return Thread.VolatileRead(ref m_completedSynchronously) == 1; }
- }
-
-
- public bool IsCompleted
- {
- get { return Thread.VolatileRead(ref m_completed) == 1; }
- }
-
- #endregion
-
- #region class Methods
-
- internal void SetAsCompleted(bool completedSynchronously)
- {
- m_completed = 1;
- if (completedSynchronously)
- m_completedSynchronously = 1;
- else
- m_completedSynchronously = 0;
-
- SignalCompletion();
- }
-
- internal void HandleException(Exception e, bool completedSynchronously)
- {
- m_completed = 1;
- if (completedSynchronously)
- m_completedSynchronously = 1;
- else
- m_completedSynchronously = 0;
- m_exception = e;
-
- SignalCompletion();
- }
-
- private void SignalCompletion()
- {
- if (m_waitHandle != null) m_waitHandle.Set();
-
- if (m_callback != null) m_callback(this);
- }
-
- public void EndInvoke()
- {
- // This method assumes that only 1 thread calls EndInvoke
- if (!IsCompleted)
- {
- // If the operation isn't done, wait for it
- AsyncWaitHandle.WaitOne();
- AsyncWaitHandle.Close();
- m_waitHandle.Close();
- m_waitHandle = null; // Allow early GC
- }
-
- // Operation is done: if an exception occured, throw it
- if (m_exception != null) throw m_exception;
- }
-
- #endregion
- }
-
- internal class AsyncResult : SimpleAsyncResult
- {
- private T m_result = default(T);
-
- public AsyncResult(AsyncCallback asyncCallback, Object state) :
- base(asyncCallback, state)
- {
- }
-
- public void SetAsCompleted(T result, bool completedSynchronously)
- {
- // Save the asynchronous operation's result
- m_result = result;
-
- // Tell the base class that the operation completed
- // sucessfully (no exception)
- base.SetAsCompleted(completedSynchronously);
- }
-
- public new T EndInvoke()
- {
- base.EndInvoke();
- return m_result;
- }
- }
-}
\ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Limit/IRequestLimitStrategy.cs b/OpenSim/Framework/Communications/Limit/IRequestLimitStrategy.cs
deleted file mode 100644
index 070d106..0000000
--- a/OpenSim/Framework/Communications/Limit/IRequestLimitStrategy.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-namespace OpenSim.Framework.Communications.Limit
-{
- ///
- /// Interface for strategies that can limit requests from the client. Currently only used in the
- /// texture modules to deal with repeated requests for certain textures. However, limiting strategies
- /// could be used with other requests.
- ///
- public interface IRequestLimitStrategy
- {
- ///
- /// Should the request be allowed? If the id is not monitored, then the request is always allowed.
- /// Otherwise, the strategy criteria will be applied.
- ///
- ///
- ///
- bool AllowRequest(TId id);
-
- ///
- /// Has the request been refused just once?
- ///
- /// False if the request has not yet been refused, or if the request has been refused more
- /// than once.
- bool IsFirstRefusal(TId id);
-
- ///
- /// Start monitoring for future AllowRequest calls. If the id is already monitored, then monitoring
- /// continues.
- ///
- ///
- void MonitorRequests(TId id);
-
- ///
- /// Is the id being monitored?
- ///
- ///
- ///
- bool IsMonitoringRequests(TId id);
- }
-}
diff --git a/OpenSim/Framework/Communications/Limit/NullLimitStrategy.cs b/OpenSim/Framework/Communications/Limit/NullLimitStrategy.cs
deleted file mode 100644
index 7672653..0000000
--- a/OpenSim/Framework/Communications/Limit/NullLimitStrategy.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-namespace OpenSim.Framework.Communications.Limit
-{
- ///
- /// Strategy which polices no limits
- ///
- public class NullLimitStrategy : IRequestLimitStrategy
- {
- public bool AllowRequest(TId id) { return true; }
- public bool IsFirstRefusal(TId id) { return false; }
- public void MonitorRequests(TId id) { /* intentionally blank */ }
- public bool IsMonitoringRequests(TId id) { return false; }
- }
-}
diff --git a/OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs b/OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs
deleted file mode 100644
index 44dd592..0000000
--- a/OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System.Collections.Generic;
-
-namespace OpenSim.Framework.Communications.Limit
-{
- ///
- /// Limit requests by discarding them after they've been repeated a certain number of times.
- ///
- public class RepeatLimitStrategy : IRequestLimitStrategy
- {
- ///
- /// Record each asset request that we're notified about.
- ///
- private readonly Dictionary requestCounts = new Dictionary();
-
- ///
- /// The maximum number of requests that can be made before we drop subsequent requests.
- ///
- private readonly int m_maxRequests;
- public int MaxRequests
- {
- get { return m_maxRequests; }
- }
-
- ///
- /// The maximum number of requests that may be served before all further
- /// requests are dropped.
- public RepeatLimitStrategy(int maxRequests)
- {
- m_maxRequests = maxRequests;
- }
-
- ///
- ///
- ///
- public bool AllowRequest(TId id)
- {
- if (requestCounts.ContainsKey(id))
- {
- requestCounts[id] += 1;
-
- if (requestCounts[id] > m_maxRequests)
- {
- return false;
- }
- }
-
- return true;
- }
-
- ///
- ///
- ///
- public bool IsFirstRefusal(TId id)
- {
- if (requestCounts.ContainsKey(id) && m_maxRequests + 1 == requestCounts[id])
- {
- return true;
- }
-
- return false;
- }
-
- ///
- ///
- ///
- public void MonitorRequests(TId id)
- {
- if (!IsMonitoringRequests(id))
- {
- requestCounts.Add(id, 1);
- }
- }
-
- ///
- ///
- ///
- public bool IsMonitoringRequests(TId id)
- {
- return requestCounts.ContainsKey(id);
- }
- }
-}
diff --git a/OpenSim/Framework/Communications/Limit/TimeLimitStrategy.cs b/OpenSim/Framework/Communications/Limit/TimeLimitStrategy.cs
deleted file mode 100644
index 7ac8293..0000000
--- a/OpenSim/Framework/Communications/Limit/TimeLimitStrategy.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Collections.Generic;
-
-namespace OpenSim.Framework.Communications.Limit
-{
- ///
- /// Limit requests by discarding repeat attempts that occur within a given time period
- ///
- /// XXX Don't use this for limiting texture downloading, at least not until we better handle multiple requests
- /// for the same texture at different resolutions.
- ///
- public class TimeLimitStrategy : IRequestLimitStrategy
- {
- ///
- /// Record the time at which an asset request occurs.
- ///
- private readonly Dictionary requests = new Dictionary();
-
- ///
- /// The minimum time period between which requests for the same data will be serviced.
- ///
- private readonly TimeSpan m_repeatPeriod;
- public TimeSpan RepeatPeriod
- {
- get { return m_repeatPeriod; }
- }
-
- ///
- ///
- public TimeLimitStrategy(TimeSpan repeatPeriod)
- {
- m_repeatPeriod = repeatPeriod;
- }
-
- ///
- ///
- ///
- public bool AllowRequest(TId id)
- {
- if (IsMonitoringRequests(id))
- {
- DateTime now = DateTime.Now;
- TimeSpan elapsed = now - requests[id].Time;
-
- if (elapsed < RepeatPeriod)
- {
- requests[id].Refusals += 1;
- return false;
- }
-
- requests[id].Time = now;
- }
-
- return true;
- }
-
- ///
- ///
- ///
- public bool IsFirstRefusal(TId id)
- {
- if (IsMonitoringRequests(id))
- {
- if (1 == requests[id].Refusals)
- {
- return true;
- }
- }
-
- return false;
- }
-
- ///
- ///
- ///
- public void MonitorRequests(TId id)
- {
- if (!IsMonitoringRequests(id))
- {
- requests.Add(id, new Request(DateTime.Now));
- }
- }
-
- ///
- ///
- ///
- public bool IsMonitoringRequests(TId id)
- {
- return requests.ContainsKey(id);
- }
- }
-
- ///
- /// Private request details.
- ///
- class Request
- {
- ///
- /// Time of last request
- ///
- public DateTime Time;
-
- ///
- /// Number of refusals associated with this request
- ///
- public int Refusals;
-
- public Request(DateTime time)
- {
- Time = time;
- }
- }
-}
diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs
index 6f517b6..ff7cb4d 100644
--- a/OpenSim/Framework/Communications/RestClient.cs
+++ b/OpenSim/Framework/Communications/RestClient.cs
@@ -519,4 +519,158 @@ namespace OpenSim.Framework.Communications
#endregion Async Invocation
}
+
+ internal class SimpleAsyncResult : IAsyncResult
+ {
+ private readonly AsyncCallback m_callback;
+
+ ///
+ /// Is process completed?
+ ///
+ /// Should really be boolean, but VolatileRead has no boolean method
+ private byte m_completed;
+
+ ///
+ /// Did process complete synchronously?
+ ///
+ /// I have a hard time imagining a scenario where this is the case, again, same issue about
+ /// booleans and VolatileRead as m_completed
+ ///
+ private byte m_completedSynchronously;
+
+ private readonly object m_asyncState;
+ private ManualResetEvent m_waitHandle;
+ private Exception m_exception;
+
+ internal SimpleAsyncResult(AsyncCallback cb, object state)
+ {
+ m_callback = cb;
+ m_asyncState = state;
+ m_completed = 0;
+ m_completedSynchronously = 1;
+ }
+
+ #region IAsyncResult Members
+
+ public object AsyncState
+ {
+ get { return m_asyncState; }
+ }
+
+ public WaitHandle AsyncWaitHandle
+ {
+ get
+ {
+ if (m_waitHandle == null)
+ {
+ bool done = IsCompleted;
+ ManualResetEvent mre = new ManualResetEvent(done);
+ if (Interlocked.CompareExchange(ref m_waitHandle, mre, null) != null)
+ {
+ mre.Close();
+ }
+ else
+ {
+ if (!done && IsCompleted)
+ {
+ m_waitHandle.Set();
+ }
+ }
+ }
+
+ return m_waitHandle;
+ }
+ }
+
+
+ public bool CompletedSynchronously
+ {
+ get { return Thread.VolatileRead(ref m_completedSynchronously) == 1; }
+ }
+
+
+ public bool IsCompleted
+ {
+ get { return Thread.VolatileRead(ref m_completed) == 1; }
+ }
+
+ #endregion
+
+ #region class Methods
+
+ internal void SetAsCompleted(bool completedSynchronously)
+ {
+ m_completed = 1;
+ if (completedSynchronously)
+ m_completedSynchronously = 1;
+ else
+ m_completedSynchronously = 0;
+
+ SignalCompletion();
+ }
+
+ internal void HandleException(Exception e, bool completedSynchronously)
+ {
+ m_completed = 1;
+ if (completedSynchronously)
+ m_completedSynchronously = 1;
+ else
+ m_completedSynchronously = 0;
+ m_exception = e;
+
+ SignalCompletion();
+ }
+
+ private void SignalCompletion()
+ {
+ if (m_waitHandle != null) m_waitHandle.Set();
+
+ if (m_callback != null) m_callback(this);
+ }
+
+ public void EndInvoke()
+ {
+ // This method assumes that only 1 thread calls EndInvoke
+ if (!IsCompleted)
+ {
+ // If the operation isn't done, wait for it
+ AsyncWaitHandle.WaitOne();
+ AsyncWaitHandle.Close();
+ m_waitHandle.Close();
+ m_waitHandle = null; // Allow early GC
+ }
+
+ // Operation is done: if an exception occured, throw it
+ if (m_exception != null) throw m_exception;
+ }
+
+ #endregion
+ }
+
+ internal class AsyncResult : SimpleAsyncResult
+ {
+ private T m_result = default(T);
+
+ public AsyncResult(AsyncCallback asyncCallback, Object state) :
+ base(asyncCallback, state)
+ {
+ }
+
+ public void SetAsCompleted(T result, bool completedSynchronously)
+ {
+ // Save the asynchronous operation's result
+ m_result = result;
+
+ // Tell the base class that the operation completed
+ // sucessfully (no exception)
+ base.SetAsCompleted(completedSynchronously);
+ }
+
+ public new T EndInvoke()
+ {
+ base.EndInvoke();
+ return m_result;
+ }
+ }
+
}
\ No newline at end of file
diff --git a/OpenSim/Framework/Communications/XMPP/XmppError.cs b/OpenSim/Framework/Communications/XMPP/XmppError.cs
deleted file mode 100644
index 3d36e9c..0000000
--- a/OpenSim/Framework/Communications/XMPP/XmppError.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System.Xml.Serialization;
-
-namespace OpenSim.Framework.Communications.XMPP
-{
- [XmlRoot("error")]
- public class XmppErrorStanza
- {
- public XmppErrorStanza()
- {
- }
- }
-}
diff --git a/OpenSim/Framework/Communications/XMPP/XmppIqStanza.cs b/OpenSim/Framework/Communications/XMPP/XmppIqStanza.cs
deleted file mode 100644
index 12263f4..0000000
--- a/OpenSim/Framework/Communications/XMPP/XmppIqStanza.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System.Xml.Serialization;
-
-namespace OpenSim.Framework.Communications.XMPP
-{
- ///
- /// An IQ needs to have one of the follow types set.
- ///
- public enum XmppIqType
- {
- [XmlEnum("set")] set,
- [XmlEnum("get")] get,
- [XmlEnum("result")] result,
- [XmlEnum("error")] error,
- }
-
- ///
- /// XmppIqStanza needs to be subclassed as the query content is
- /// specific to the query type.
- ///
- [XmlRoot("iq")]
- public abstract class XmppIqStanza: XmppStanza
- {
- ///
- /// IQ type: one of set, get, result, error
- ///
- [XmlAttribute("type")]
- public XmppIqType Type;
-
- public XmppIqStanza(): base()
- {
- }
- }
-}
diff --git a/OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs b/OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs
deleted file mode 100644
index 1e8c33e..0000000
--- a/OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System.Xml.Serialization;
-
-namespace OpenSim.Framework.Communications.XMPP
-{
- ///
- /// Message types.
- ///
- public enum XmppMessageType
- {
- [XmlEnum("chat")] chat,
- [XmlEnum("error")] error,
- [XmlEnum("groupchat")] groupchat,
- [XmlEnum("headline")] headline,
- [XmlEnum("normal")] normal,
- }
-
- ///
- /// Message body.
- ///
- public class XmppMessageBody
- {
- [XmlText]
- public string Text;
-
- public XmppMessageBody()
- {
- }
-
- public XmppMessageBody(string message)
- {
- Text = message;
- }
-
- new public string ToString()
- {
- return Text;
- }
- }
-
- [XmlRoot("message")]
- public class XmppMessageStanza: XmppStanza
- {
- ///
- /// IQ type: one of set, get, result, error
- ///
- [XmlAttribute("type")]
- public XmppMessageType MessageType;
-
- // [XmlAttribute("error")]
- // public XmppError Error;
-
- [XmlElement("body")]
- public XmppMessageBody Body;
-
- public XmppMessageStanza() : base()
- {
- }
-
- public XmppMessageStanza(string fromJid, string toJid, XmppMessageType mType, string message) :
- base(fromJid, toJid)
- {
- MessageType = mType;
- Body = new XmppMessageBody(message);
- }
- }
-}
diff --git a/OpenSim/Framework/Communications/XMPP/XmppPresenceStanza.cs b/OpenSim/Framework/Communications/XMPP/XmppPresenceStanza.cs
deleted file mode 100644
index 4d45ac0..0000000
--- a/OpenSim/Framework/Communications/XMPP/XmppPresenceStanza.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System.Xml.Serialization;
-
-namespace OpenSim.Framework.Communications.XMPP
-{
- ///
- /// Message types.
- ///
- public enum XmppPresenceType
- {
- [XmlEnum("unavailable")] unavailable,
- [XmlEnum("subscribe")] subscribe,
- [XmlEnum("subscribed")] subscribed,
- [XmlEnum("unsubscribe")] unsubscribe,
- [XmlEnum("unsubscribed")] unsubscribed,
- [XmlEnum("probe")] probe,
- [XmlEnum("error")] error,
- }
-
-
- [XmlRoot("message")]
- public class XmppPresenceStanza: XmppStanza
- {
- ///
- /// IQ type: one of set, get, result, error
- ///
- [XmlAttribute("type")]
- public XmppPresenceType PresenceType;
-
- // [XmlAttribute("error")]
- // public XmppError Error;
-
- public XmppPresenceStanza() : base()
- {
- }
-
- public XmppPresenceStanza(string fromJid, string toJid, XmppPresenceType pType) :
- base(fromJid, toJid)
- {
- PresenceType = pType;
- }
- }
-}
diff --git a/OpenSim/Framework/Communications/XMPP/XmppSerializer.cs b/OpenSim/Framework/Communications/XMPP/XmppSerializer.cs
deleted file mode 100644
index e37ef28..0000000
--- a/OpenSim/Framework/Communications/XMPP/XmppSerializer.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Collections.Generic;
-using System.Xml;
-using System.Xml.Serialization;
-
-namespace OpenSim.Framework.Communications.XMPP
-{
- public class XmppSerializer
- {
- // private static readonly ILog _log =
- // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- // need to do it this way, as XmlSerializer(type, extratypes)
- // does not work on mono (at least).
- private Dictionary _serializerForType = new Dictionary();
- private Dictionary _serializerForName = new Dictionary();
- private XmlSerializerNamespaces _xmlNs;
- private string _defaultNS;
-
- public XmppSerializer(bool server)
- {
- _xmlNs = new XmlSerializerNamespaces();
- _xmlNs.Add(String.Empty, String.Empty);
- if (server)
- _defaultNS = "jabber:server";
- else
- _defaultNS = "jabber:client";
-
- // TODO: do this via reflection
- _serializerForType[typeof(XmppMessageStanza)] = _serializerForName["message"] =
- new XmlSerializer(typeof(XmppMessageStanza), _defaultNS);
- }
-
- public void Serialize(XmlWriter xw, object o)
- {
- if (!_serializerForType.ContainsKey(o.GetType()))
- throw new ArgumentException(String.Format("no serializer available for type {0}", o.GetType()));
-
- _serializerForType[o.GetType()].Serialize(xw, o, _xmlNs);
- }
-
- public object Deserialize(XmlReader xr)
- {
- // position on next element
- xr.Read();
- if (!_serializerForName.ContainsKey(xr.LocalName))
- throw new ArgumentException(String.Format("no serializer available for name {0}", xr.LocalName));
-
- return _serializerForName[xr.LocalName].Deserialize(xr);
- }
- }
-}
diff --git a/OpenSim/Framework/Communications/XMPP/XmppStanza.cs b/OpenSim/Framework/Communications/XMPP/XmppStanza.cs
deleted file mode 100644
index 5312a31..0000000
--- a/OpenSim/Framework/Communications/XMPP/XmppStanza.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Xml.Serialization;
-
-namespace OpenSim.Framework.Communications.XMPP
-{
- public abstract class XmppStanza
- {
- ///
- /// counter used for generating ID
- ///
- [XmlIgnore]
- private static ulong _ctr = 0;
-
- ///
- /// recipient JID
- ///
- [XmlAttribute("to")]
- public string ToJid;
-
- ///
- /// sender JID
- ///
- [XmlAttribute("from")]
- public string FromJid;
-
- ///
- /// unique ID.
- ///
- [XmlAttribute("id")]
- public string MessageId;
-
- public XmppStanza()
- {
- }
-
- public XmppStanza(string fromJid, string toJid)
- {
- ToJid = toJid;
- FromJid = fromJid;
- MessageId = String.Format("OpenSim_{0}{1}", DateTime.UtcNow.Ticks, _ctr++);
- }
- }
-}
diff --git a/OpenSim/Framework/Communications/XMPP/XmppWriter.cs b/OpenSim/Framework/Communications/XMPP/XmppWriter.cs
deleted file mode 100644
index 415d808..0000000
--- a/OpenSim/Framework/Communications/XMPP/XmppWriter.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System.IO;
-using System.Text;
-using System.Xml;
-using IOStream = System.IO.Stream;
-
-namespace OpenSim.Framework.Communications.XMPP
-{
- public class XMPPWriter: XmlTextWriter
- {
- public XMPPWriter(TextWriter textWriter) : base(textWriter)
- {
- }
-
- public XMPPWriter(IOStream stream) : this(stream, Util.UTF8)
- {
- }
-
- public XMPPWriter(IOStream stream, Encoding enc) : base(stream, enc)
- {
- }
-
- public override void WriteStartDocument()
- {
- }
-
- public override void WriteStartDocument(bool standalone)
- {
- }
- }
-}
--
cgit v1.1
From d00f73c3a4cac77c97dcf4df1613fb85a516ffb4 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Fri, 4 Sep 2015 14:39:23 -0700
Subject: Deleted OpenSim.Framework.Communications. Moved its two remaining
files to OpenSim.Framework.
---
.../Framework/Communications/OutboundUrlFilter.cs | 256 --------
.../Communications/Properties/AssemblyInfo.cs | 65 --
OpenSim/Framework/Communications/RestClient.cs | 676 ---------------------
OpenSim/Framework/OutboundUrlFilter.cs | 256 ++++++++
OpenSim/Framework/RestClient.cs | 676 +++++++++++++++++++++
5 files changed, 932 insertions(+), 997 deletions(-)
delete mode 100644 OpenSim/Framework/Communications/OutboundUrlFilter.cs
delete mode 100644 OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
delete mode 100644 OpenSim/Framework/Communications/RestClient.cs
create mode 100644 OpenSim/Framework/OutboundUrlFilter.cs
create mode 100644 OpenSim/Framework/RestClient.cs
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Communications/OutboundUrlFilter.cs b/OpenSim/Framework/Communications/OutboundUrlFilter.cs
deleted file mode 100644
index 8b572d1..0000000
--- a/OpenSim/Framework/Communications/OutboundUrlFilter.cs
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.Reflection;
-using log4net;
-using LukeSkywalker.IPNetwork;
-using Nini.Config;
-
-namespace OpenSim.Framework.Communications
-{
- public class OutboundUrlFilter
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- public string Name { get; private set; }
-
- private List m_blacklistNetworks;
- private List m_blacklistEndPoints;
-
- private List m_blacklistExceptionNetworks;
- private List m_blacklistExceptionEndPoints;
-
- public OutboundUrlFilter(
- string name,
- List blacklistNetworks, List blacklistEndPoints,
- List blacklistExceptionNetworks, List blacklistExceptionEndPoints)
- {
- Name = name;
-
- m_blacklistNetworks = blacklistNetworks;
- m_blacklistEndPoints = blacklistEndPoints;
- m_blacklistExceptionNetworks = blacklistExceptionNetworks;
- m_blacklistExceptionEndPoints = blacklistExceptionEndPoints;
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Name of the filter for logging purposes.
- /// Filter configuration
- public OutboundUrlFilter(string name, IConfigSource config)
- {
- Name = name;
-
- string configBlacklist
- = "0.0.0.0/8|10.0.0.0/8|100.64.0.0/10|127.0.0.0/8|169.254.0.0/16|172.16.0.0/12|192.0.0.0/24|192.0.2.0/24|192.88.99.0/24|192.168.0.0/16|198.18.0.0/15|198.51.100.0/24|203.0.113.0/24|224.0.0.0/4|240.0.0.0/4|255.255.255.255/32";
- string configBlacklistExceptions = "";
-
- IConfig networkConfig = config.Configs["Network"];
-
- if (networkConfig != null)
- {
- configBlacklist = networkConfig.GetString("OutboundDisallowForUserScripts", configBlacklist);
- configBlacklistExceptions
- = networkConfig.GetString("OutboundDisallowForUserScriptsExcept", configBlacklistExceptions);
- }
-
- m_log.DebugFormat(
- "[OUTBOUND URL FILTER]: OutboundDisallowForUserScripts for {0} is [{1}]", Name, configBlacklist);
- m_log.DebugFormat(
- "[OUTBOUND URL FILTER]: OutboundDisallowForUserScriptsExcept for {0} is [{1}]", Name, configBlacklistExceptions);
-
- OutboundUrlFilter.ParseConfigList(
- configBlacklist, Name, out m_blacklistNetworks, out m_blacklistEndPoints);
- OutboundUrlFilter.ParseConfigList(
- configBlacklistExceptions, Name, out m_blacklistExceptionNetworks, out m_blacklistExceptionEndPoints);
- }
-
- private static void ParseConfigList(
- string fullConfigEntry, string filterName, out List networks, out List endPoints)
- {
- // Parse blacklist
- string[] configBlacklistEntries
- = fullConfigEntry.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
-
- configBlacklistEntries = configBlacklistEntries.Select(e => e.Trim()).ToArray();
-
- networks = new List();
- endPoints = new List();
-
- foreach (string configEntry in configBlacklistEntries)
- {
- if (configEntry.Contains("/"))
- {
- IPNetwork network;
-
- if (!IPNetwork.TryParse(configEntry, out network))
- {
- m_log.ErrorFormat(
- "[OUTBOUND URL FILTER]: Entry [{0}] is invalid network for {1}", configEntry, filterName);
-
- continue;
- }
-
- networks.Add(network);
- }
- else
- {
- Uri configEntryUri;
-
- if (!Uri.TryCreate("http://" + configEntry, UriKind.Absolute, out configEntryUri))
- {
- m_log.ErrorFormat(
- "[OUTBOUND URL FILTER]: EndPoint entry [{0}] is invalid endpoint for {1}",
- configEntry, filterName);
-
- continue;
- }
-
- IPAddress[] addresses = Dns.GetHostAddresses(configEntryUri.Host);
-
- foreach (IPAddress addr in addresses)
- {
- if (addr.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
- {
- // m_log.DebugFormat("[OUTBOUND URL FILTER]: Found address [{0}] in config", addr);
-
- IPEndPoint configEntryEp = new IPEndPoint(addr, configEntryUri.Port);
- endPoints.Add(configEntryEp);
-
- // m_log.DebugFormat("[OUTBOUND URL FILTER]: Added blacklist exception [{0}]", configEntryEp);
- }
- }
- }
- }
- }
-
- ///
- /// Determines if an url is in a list of networks and endpoints.
- ///
- ///
- /// IP address
- ///
- /// Networks.
- /// End points.
- /// Filter name.
- private static bool IsInNetwork(
- IPAddress addr, int port, List networks, List endPoints, string filterName)
- {
- foreach (IPNetwork ipn in networks)
- {
-// m_log.DebugFormat(
-// "[OUTBOUND URL FILTER]: Checking [{0}] against network [{1}]", addr, ipn);
-
- if (IPNetwork.Contains(ipn, addr))
- {
-// m_log.DebugFormat(
-// "[OUTBOUND URL FILTER]: Found [{0}] in network [{1}]", addr, ipn);
-
- return true;
- }
- }
-
- // m_log.DebugFormat("[OUTBOUND URL FILTER]: Found address [{0}]", addr);
-
- foreach (IPEndPoint ep in endPoints)
- {
-// m_log.DebugFormat(
-// "[OUTBOUND URL FILTER]: Checking [{0}:{1}] against endpoint [{2}]",
-// addr, port, ep);
-
- if (addr.Equals(ep.Address) && port == ep.Port)
- {
-// m_log.DebugFormat(
-// "[OUTBOUND URL FILTER]: Found [{0}:{1}] in endpoint [{2}]", addr, port, ep);
-
- return true;
- }
- }
-
-// m_log.DebugFormat("[OUTBOUND URL FILTER]: Did not find [{0}:{1}] in list", addr, port);
-
- return false;
- }
-
- ///
- /// Checks whether the given url is allowed by the filter.
- ///
- ///
- public bool CheckAllowed(Uri url)
- {
- bool allowed = true;
-
- // Check that we are permitted to make calls to this endpoint.
- bool foundIpv4Address = false;
-
- IPAddress[] addresses = Dns.GetHostAddresses(url.Host);
-
- foreach (IPAddress addr in addresses)
- {
- if (addr.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
- {
-// m_log.DebugFormat("[OUTBOUND URL FILTER]: Found address [{0}]", addr);
-
- foundIpv4Address = true;
-
- // Check blacklist
- if (OutboundUrlFilter.IsInNetwork(addr, url.Port, m_blacklistNetworks, m_blacklistEndPoints, Name))
- {
-// m_log.DebugFormat("[OUTBOUND URL FILTER]: Found [{0}] in blacklist for {1}", url, Name);
-
- // Check blacklist exceptions
- allowed
- = OutboundUrlFilter.IsInNetwork(
- addr, url.Port, m_blacklistExceptionNetworks, m_blacklistExceptionEndPoints, Name);
-
-// if (allowed)
-// m_log.DebugFormat("[OUTBOUND URL FILTER]: Found [{0}] in whitelist for {1}", url, Name);
- }
- }
-
- // Found at least one address in a blacklist and not a blacklist exception
- if (!allowed)
- return false;
-// else
-// m_log.DebugFormat("[OUTBOUND URL FILTER]: URL [{0}] not in blacklist for {1}", url, Name);
- }
-
- // We do not know how to handle IPv6 securely yet.
- if (!foundIpv4Address)
- return false;
-
-// m_log.DebugFormat("[OUTBOUND URL FILTER]: Allowing request [{0}]", url);
-
- return allowed;
- }
- }
-}
\ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
deleted file mode 100644
index b398167..0000000
--- a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-// General information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly : AssemblyTitle("OpenSim.Framework.Communications")]
-[assembly : AssemblyDescription("")]
-[assembly : AssemblyConfiguration("")]
-[assembly : AssemblyCompany("http://opensimulator.org")]
-[assembly : AssemblyProduct("OpenSim")]
-[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers")]
-[assembly : AssemblyTrademark("")]
-[assembly : AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-
-[assembly : ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-
-[assembly : Guid("13e7c396-78a9-4a5c-baf2-6f980ea75d95")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-
-[assembly : AssemblyVersion("0.8.2.*")]
-
diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs
deleted file mode 100644
index ff7cb4d..0000000
--- a/OpenSim/Framework/Communications/RestClient.cs
+++ /dev/null
@@ -1,676 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Net;
-using System.Reflection;
-using System.Text;
-using System.Threading;
-using System.Web;
-using log4net;
-
-using OpenSim.Framework.ServiceAuth;
-
-namespace OpenSim.Framework.Communications
-{
- ///
- /// Implementation of a generic REST client
- ///
- ///
- /// This class is a generic implementation of a REST (Representational State Transfer) web service. This
- /// class is designed to execute both synchronously and asynchronously.
- ///
- /// Internally the implementation works as a two stage asynchronous web-client.
- /// When the request is initiated, RestClient will query asynchronously for for a web-response,
- /// sleeping until the initial response is returned by the server. Once the initial response is retrieved
- /// the second stage of asynchronous requests will be triggered, in an attempt to read of the response
- /// object into a memorystream as a sequence of asynchronous reads.
- ///
- /// The asynchronisity of RestClient is designed to move as much processing into the back-ground, allowing
- /// other threads to execute, while it waits for a response from the web-service. RestClient itself can be
- /// invoked by the caller in either synchronous mode or asynchronous modes.
- ///
- public class RestClient : IDisposable
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- // private string realuri;
-
- #region member variables
-
- ///
- /// The base Uri of the web-service e.g. http://www.google.com
- ///
- private string _url;
-
- ///
- /// Path elements of the query
- ///
- private List _pathElements = new List();
-
- ///
- /// Parameter elements of the query, e.g. min=34
- ///
- private Dictionary _parameterElements = new Dictionary();
-
- ///
- /// Request method. E.g. GET, POST, PUT or DELETE
- ///
- private string _method;
-
- ///
- /// Temporary buffer used to store bytes temporarily as they come in from the server
- ///
- private byte[] _readbuf;
-
- ///
- /// MemoryStream representing the resulting resource
- ///
- private Stream _resource;
-
- ///
- /// WebRequest object, held as a member variable
- ///
- private HttpWebRequest _request;
-
- ///
- /// WebResponse object, held as a member variable, so we can close it
- ///
- private HttpWebResponse _response;
-
- ///
- /// This flag will help block the main synchroneous method, in case we run in synchroneous mode
- ///
- //public static ManualResetEvent _allDone = new ManualResetEvent(false);
-
- ///
- /// Default time out period
- ///
- //private const int DefaultTimeout = 10*1000; // 10 seconds timeout
-
- ///
- /// Default Buffer size of a block requested from the web-server
- ///
- private const int BufferSize = 4096; // Read blocks of 4 KB.
-
-
- ///
- /// if an exception occours during async processing, we need to save it, so it can be
- /// rethrown on the primary thread;
- ///
- private Exception _asyncException;
-
- #endregion member variables
-
- #region constructors
-
- ///
- /// Instantiate a new RestClient
- ///
- /// Web-service to query, e.g. http://osgrid.org:8003
- public RestClient(string url)
- {
- _url = url;
- _readbuf = new byte[BufferSize];
- _resource = new MemoryStream();
- _request = null;
- _response = null;
- _lock = new object();
- }
-
- private object _lock;
-
- #endregion constructors
-
-
- #region Dispose
-
- private bool disposed = false;
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (disposed)
- return;
-
- if (disposing)
- {
- _resource.Dispose();
- }
-
- disposed = true;
- }
-
- #endregion Dispose
-
-
- ///
- /// Add a path element to the query, e.g. assets
- ///
- /// path entry
- public void AddResourcePath(string element)
- {
- if (isSlashed(element))
- _pathElements.Add(element.Substring(0, element.Length - 1));
- else
- _pathElements.Add(element);
- }
-
- ///
- /// Add a query parameter to the Url
- ///
- /// Name of the parameter, e.g. min
- /// Value of the parameter, e.g. 42
- public void AddQueryParameter(string name, string value)
- {
- try
- {
- _parameterElements.Add(HttpUtility.UrlEncode(name), HttpUtility.UrlEncode(value));
- }
- catch (ArgumentException)
- {
- m_log.Error("[REST]: Query parameter " + name + " is already added.");
- }
- catch (Exception e)
- {
- m_log.Error("[REST]: An exception was raised adding query parameter to dictionary. Exception: {0}",e);
- }
- }
-
- ///
- /// Add a query parameter to the Url
- ///
- /// Name of the parameter, e.g. min
- public void AddQueryParameter(string name)
- {
- try
- {
- _parameterElements.Add(HttpUtility.UrlEncode(name), null);
- }
- catch (ArgumentException)
- {
- m_log.Error("[REST]: Query parameter " + name + " is already added.");
- }
- catch (Exception e)
- {
- m_log.Error("[REST]: An exception was raised adding query parameter to dictionary. Exception: {0}",e);
- }
- }
-
- ///
- /// Web-Request method, e.g. GET, PUT, POST, DELETE
- ///
- public string RequestMethod
- {
- get { return _method; }
- set { _method = value; }
- }
-
- ///
- /// True if string contains a trailing slash '/'
- ///
- /// string to be examined
- /// true if slash is present
- private static bool isSlashed(string s)
- {
- return s.Substring(s.Length - 1, 1) == "/";
- }
-
- ///
- /// Build a Uri based on the initial Url, path elements and parameters
- ///
- /// fully constructed Uri
- private Uri buildUri()
- {
- StringBuilder sb = new StringBuilder();
- sb.Append(_url);
-
- foreach (string e in _pathElements)
- {
- sb.Append("/");
- sb.Append(e);
- }
-
- bool firstElement = true;
- foreach (KeyValuePair kv in _parameterElements)
- {
- if (firstElement)
- {
- sb.Append("?");
- firstElement = false;
- }
- else
- sb.Append("&");
-
- sb.Append(kv.Key);
- if (!string.IsNullOrEmpty(kv.Value))
- {
- sb.Append("=");
- sb.Append(kv.Value);
- }
- }
- // realuri = sb.ToString();
- //m_log.InfoFormat("[REST CLIENT]: RestURL: {0}", realuri);
- return new Uri(sb.ToString());
- }
-
- #region Async communications with server
-
- ///
- /// Async method, invoked when a block of data has been received from the service
- ///
- ///
- private void StreamIsReadyDelegate(IAsyncResult ar)
- {
- try
- {
- Stream s = (Stream) ar.AsyncState;
- int read = s.EndRead(ar);
-
- if (read > 0)
- {
- _resource.Write(_readbuf, 0, read);
- // IAsyncResult asynchronousResult =
- // s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s);
- s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s);
-
- // TODO! Implement timeout, without killing the server
- //ThreadPool.RegisterWaitForSingleObject(asynchronousResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
- }
- else
- {
- s.Close();
- //_allDone.Set();
- }
- }
- catch (Exception e)
- {
- //_allDone.Set();
- _asyncException = e;
- }
- }
-
- #endregion Async communications with server
-
- ///
- /// Perform a synchronous request
- ///
- public Stream Request()
- {
- return Request(null);
- }
-
- ///
- /// Perform a synchronous request
- ///
- public Stream Request(IServiceAuth auth)
- {
- lock (_lock)
- {
- _request = (HttpWebRequest) WebRequest.Create(buildUri());
- _request.KeepAlive = false;
- _request.ContentType = "application/xml";
- _request.Timeout = 200000;
- _request.Method = RequestMethod;
- _asyncException = null;
- if (auth != null)
- auth.AddAuthorization(_request.Headers);
-
- int reqnum = WebUtil.RequestNumber++;
- if (WebUtil.DebugLevel >= 3)
- m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} REST {1} to {2}", reqnum, _request.Method, _request.RequestUri);
-
-// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
-
- try
- {
- using (_response = (HttpWebResponse) _request.GetResponse())
- {
- using (Stream src = _response.GetResponseStream())
- {
- int length = src.Read(_readbuf, 0, BufferSize);
- while (length > 0)
- {
- _resource.Write(_readbuf, 0, length);
- length = src.Read(_readbuf, 0, BufferSize);
- }
-
- // TODO! Implement timeout, without killing the server
- // this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted
- //ThreadPool.RegisterWaitForSingleObject(responseAsyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
-
- // _allDone.WaitOne();
- }
- }
- }
- catch (WebException e)
- {
- using (HttpWebResponse errorResponse = e.Response as HttpWebResponse)
- {
- if (null != errorResponse && HttpStatusCode.NotFound == errorResponse.StatusCode)
- {
- // This is often benign. E.g., requesting a missing asset will return 404.
- m_log.DebugFormat("[REST CLIENT] Resource not found (404): {0}", _request.Address.ToString());
- }
- else
- {
- m_log.Error(string.Format("[REST CLIENT] Error fetching resource from server: {0} ", _request.Address.ToString()), e);
- }
- }
-
- return null;
- }
-
- if (_asyncException != null)
- throw _asyncException;
-
- if (_resource != null)
- {
- _resource.Flush();
- _resource.Seek(0, SeekOrigin.Begin);
- }
-
- if (WebUtil.DebugLevel >= 5)
- WebUtil.LogResponseDetail(reqnum, _resource);
-
- return _resource;
- }
- }
-
- public Stream Request(Stream src, IServiceAuth auth)
- {
- _request = (HttpWebRequest) WebRequest.Create(buildUri());
- _request.KeepAlive = false;
- _request.ContentType = "application/xml";
- _request.Timeout = 900000;
- _request.Method = RequestMethod;
- _asyncException = null;
- _request.ContentLength = src.Length;
- if (auth != null)
- auth.AddAuthorization(_request.Headers);
-
- src.Seek(0, SeekOrigin.Begin);
-
- int reqnum = WebUtil.RequestNumber++;
- if (WebUtil.DebugLevel >= 3)
- m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} REST {1} to {2}", reqnum, _request.Method, _request.RequestUri);
- if (WebUtil.DebugLevel >= 5)
- WebUtil.LogOutgoingDetail(string.Format("SEND {0}: ", reqnum), src);
-
- Stream dst = _request.GetRequestStream();
-
- byte[] buf = new byte[1024];
- int length = src.Read(buf, 0, 1024);
- while (length > 0)
- {
- dst.Write(buf, 0, length);
- length = src.Read(buf, 0, 1024);
- }
-
- try
- {
- _response = (HttpWebResponse)_request.GetResponse();
- }
- catch (WebException e)
- {
- m_log.WarnFormat("[REST]: Request {0} {1} failed with status {2} and message {3}",
- RequestMethod, _request.RequestUri, e.Status, e.Message);
- return null;
- }
- catch (Exception e)
- {
- m_log.WarnFormat(
- "[REST]: Request {0} {1} failed with exception {2} {3}",
- RequestMethod, _request.RequestUri, e.Message, e.StackTrace);
- return null;
- }
-
- if (WebUtil.DebugLevel >= 5)
- {
- using (Stream responseStream = _response.GetResponseStream())
- {
- using (StreamReader reader = new StreamReader(responseStream))
- {
- string responseStr = reader.ReadToEnd();
- WebUtil.LogResponseDetail(reqnum, responseStr);
- }
- }
- }
-
- _response.Close();
-
-// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
-
- // TODO! Implement timeout, without killing the server
- // this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted
- //ThreadPool.RegisterWaitForSingleObject(responseAsyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
-
- return null;
- }
-
- #region Async Invocation
-
- public IAsyncResult BeginRequest(AsyncCallback callback, object state)
- {
- ///
- /// In case, we are invoked asynchroneously this object will keep track of the state
- ///
- AsyncResult ar = new AsyncResult(callback, state);
- Util.FireAndForget(RequestHelper, ar, "RestClient.BeginRequest");
- return ar;
- }
-
- public Stream EndRequest(IAsyncResult asyncResult)
- {
- AsyncResult ar = (AsyncResult) asyncResult;
-
- // Wait for operation to complete, then return result or
- // throw exception
- return ar.EndInvoke();
- }
-
- private void RequestHelper(Object asyncResult)
- {
- // We know that it's really an AsyncResult object
- AsyncResult ar = (AsyncResult) asyncResult;
- try
- {
- // Perform the operation; if sucessful set the result
- Stream s = Request(null);
- ar.SetAsCompleted(s, false);
- }
- catch (Exception e)
- {
- // If operation fails, set the exception
- ar.HandleException(e, false);
- }
- }
-
- #endregion Async Invocation
- }
-
- internal class SimpleAsyncResult : IAsyncResult
- {
- private readonly AsyncCallback m_callback;
-
- ///
- /// Is process completed?
- ///
- /// Should really be boolean, but VolatileRead has no boolean method
- private byte m_completed;
-
- ///
- /// Did process complete synchronously?
- ///
- /// I have a hard time imagining a scenario where this is the case, again, same issue about
- /// booleans and VolatileRead as m_completed
- ///
- private byte m_completedSynchronously;
-
- private readonly object m_asyncState;
- private ManualResetEvent m_waitHandle;
- private Exception m_exception;
-
- internal SimpleAsyncResult(AsyncCallback cb, object state)
- {
- m_callback = cb;
- m_asyncState = state;
- m_completed = 0;
- m_completedSynchronously = 1;
- }
-
- #region IAsyncResult Members
-
- public object AsyncState
- {
- get { return m_asyncState; }
- }
-
- public WaitHandle AsyncWaitHandle
- {
- get
- {
- if (m_waitHandle == null)
- {
- bool done = IsCompleted;
- ManualResetEvent mre = new ManualResetEvent(done);
- if (Interlocked.CompareExchange(ref m_waitHandle, mre, null) != null)
- {
- mre.Close();
- }
- else
- {
- if (!done && IsCompleted)
- {
- m_waitHandle.Set();
- }
- }
- }
-
- return m_waitHandle;
- }
- }
-
-
- public bool CompletedSynchronously
- {
- get { return Thread.VolatileRead(ref m_completedSynchronously) == 1; }
- }
-
-
- public bool IsCompleted
- {
- get { return Thread.VolatileRead(ref m_completed) == 1; }
- }
-
- #endregion
-
- #region class Methods
-
- internal void SetAsCompleted(bool completedSynchronously)
- {
- m_completed = 1;
- if (completedSynchronously)
- m_completedSynchronously = 1;
- else
- m_completedSynchronously = 0;
-
- SignalCompletion();
- }
-
- internal void HandleException(Exception e, bool completedSynchronously)
- {
- m_completed = 1;
- if (completedSynchronously)
- m_completedSynchronously = 1;
- else
- m_completedSynchronously = 0;
- m_exception = e;
-
- SignalCompletion();
- }
-
- private void SignalCompletion()
- {
- if (m_waitHandle != null) m_waitHandle.Set();
-
- if (m_callback != null) m_callback(this);
- }
-
- public void EndInvoke()
- {
- // This method assumes that only 1 thread calls EndInvoke
- if (!IsCompleted)
- {
- // If the operation isn't done, wait for it
- AsyncWaitHandle.WaitOne();
- AsyncWaitHandle.Close();
- m_waitHandle.Close();
- m_waitHandle = null; // Allow early GC
- }
-
- // Operation is done: if an exception occured, throw it
- if (m_exception != null) throw m_exception;
- }
-
- #endregion
- }
-
- internal class AsyncResult : SimpleAsyncResult
- {
- private T m_result = default(T);
-
- public AsyncResult(AsyncCallback asyncCallback, Object state) :
- base(asyncCallback, state)
- {
- }
-
- public void SetAsCompleted(T result, bool completedSynchronously)
- {
- // Save the asynchronous operation's result
- m_result = result;
-
- // Tell the base class that the operation completed
- // sucessfully (no exception)
- base.SetAsCompleted(completedSynchronously);
- }
-
- public new T EndInvoke()
- {
- base.EndInvoke();
- return m_result;
- }
- }
-
-}
\ No newline at end of file
diff --git a/OpenSim/Framework/OutboundUrlFilter.cs b/OpenSim/Framework/OutboundUrlFilter.cs
new file mode 100644
index 0000000..baa3647
--- /dev/null
+++ b/OpenSim/Framework/OutboundUrlFilter.cs
@@ -0,0 +1,256 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Reflection;
+using log4net;
+using LukeSkywalker.IPNetwork;
+using Nini.Config;
+
+namespace OpenSim.Framework
+{
+ public class OutboundUrlFilter
+ {
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ public string Name { get; private set; }
+
+ private List m_blacklistNetworks;
+ private List m_blacklistEndPoints;
+
+ private List m_blacklistExceptionNetworks;
+ private List m_blacklistExceptionEndPoints;
+
+ public OutboundUrlFilter(
+ string name,
+ List blacklistNetworks, List blacklistEndPoints,
+ List blacklistExceptionNetworks, List blacklistExceptionEndPoints)
+ {
+ Name = name;
+
+ m_blacklistNetworks = blacklistNetworks;
+ m_blacklistEndPoints = blacklistEndPoints;
+ m_blacklistExceptionNetworks = blacklistExceptionNetworks;
+ m_blacklistExceptionEndPoints = blacklistExceptionEndPoints;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Name of the filter for logging purposes.
+ /// Filter configuration
+ public OutboundUrlFilter(string name, IConfigSource config)
+ {
+ Name = name;
+
+ string configBlacklist
+ = "0.0.0.0/8|10.0.0.0/8|100.64.0.0/10|127.0.0.0/8|169.254.0.0/16|172.16.0.0/12|192.0.0.0/24|192.0.2.0/24|192.88.99.0/24|192.168.0.0/16|198.18.0.0/15|198.51.100.0/24|203.0.113.0/24|224.0.0.0/4|240.0.0.0/4|255.255.255.255/32";
+ string configBlacklistExceptions = "";
+
+ IConfig networkConfig = config.Configs["Network"];
+
+ if (networkConfig != null)
+ {
+ configBlacklist = networkConfig.GetString("OutboundDisallowForUserScripts", configBlacklist);
+ configBlacklistExceptions
+ = networkConfig.GetString("OutboundDisallowForUserScriptsExcept", configBlacklistExceptions);
+ }
+
+ m_log.DebugFormat(
+ "[OUTBOUND URL FILTER]: OutboundDisallowForUserScripts for {0} is [{1}]", Name, configBlacklist);
+ m_log.DebugFormat(
+ "[OUTBOUND URL FILTER]: OutboundDisallowForUserScriptsExcept for {0} is [{1}]", Name, configBlacklistExceptions);
+
+ OutboundUrlFilter.ParseConfigList(
+ configBlacklist, Name, out m_blacklistNetworks, out m_blacklistEndPoints);
+ OutboundUrlFilter.ParseConfigList(
+ configBlacklistExceptions, Name, out m_blacklistExceptionNetworks, out m_blacklistExceptionEndPoints);
+ }
+
+ private static void ParseConfigList(
+ string fullConfigEntry, string filterName, out List networks, out List endPoints)
+ {
+ // Parse blacklist
+ string[] configBlacklistEntries
+ = fullConfigEntry.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
+
+ configBlacklistEntries = configBlacklistEntries.Select(e => e.Trim()).ToArray();
+
+ networks = new List();
+ endPoints = new List();
+
+ foreach (string configEntry in configBlacklistEntries)
+ {
+ if (configEntry.Contains("/"))
+ {
+ IPNetwork network;
+
+ if (!IPNetwork.TryParse(configEntry, out network))
+ {
+ m_log.ErrorFormat(
+ "[OUTBOUND URL FILTER]: Entry [{0}] is invalid network for {1}", configEntry, filterName);
+
+ continue;
+ }
+
+ networks.Add(network);
+ }
+ else
+ {
+ Uri configEntryUri;
+
+ if (!Uri.TryCreate("http://" + configEntry, UriKind.Absolute, out configEntryUri))
+ {
+ m_log.ErrorFormat(
+ "[OUTBOUND URL FILTER]: EndPoint entry [{0}] is invalid endpoint for {1}",
+ configEntry, filterName);
+
+ continue;
+ }
+
+ IPAddress[] addresses = Dns.GetHostAddresses(configEntryUri.Host);
+
+ foreach (IPAddress addr in addresses)
+ {
+ if (addr.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
+ {
+ // m_log.DebugFormat("[OUTBOUND URL FILTER]: Found address [{0}] in config", addr);
+
+ IPEndPoint configEntryEp = new IPEndPoint(addr, configEntryUri.Port);
+ endPoints.Add(configEntryEp);
+
+ // m_log.DebugFormat("[OUTBOUND URL FILTER]: Added blacklist exception [{0}]", configEntryEp);
+ }
+ }
+ }
+ }
+ }
+
+ ///
+ /// Determines if an url is in a list of networks and endpoints.
+ ///
+ ///
+ /// IP address
+ ///
+ /// Networks.
+ /// End points.
+ /// Filter name.
+ private static bool IsInNetwork(
+ IPAddress addr, int port, List networks, List endPoints, string filterName)
+ {
+ foreach (IPNetwork ipn in networks)
+ {
+// m_log.DebugFormat(
+// "[OUTBOUND URL FILTER]: Checking [{0}] against network [{1}]", addr, ipn);
+
+ if (IPNetwork.Contains(ipn, addr))
+ {
+// m_log.DebugFormat(
+// "[OUTBOUND URL FILTER]: Found [{0}] in network [{1}]", addr, ipn);
+
+ return true;
+ }
+ }
+
+ // m_log.DebugFormat("[OUTBOUND URL FILTER]: Found address [{0}]", addr);
+
+ foreach (IPEndPoint ep in endPoints)
+ {
+// m_log.DebugFormat(
+// "[OUTBOUND URL FILTER]: Checking [{0}:{1}] against endpoint [{2}]",
+// addr, port, ep);
+
+ if (addr.Equals(ep.Address) && port == ep.Port)
+ {
+// m_log.DebugFormat(
+// "[OUTBOUND URL FILTER]: Found [{0}:{1}] in endpoint [{2}]", addr, port, ep);
+
+ return true;
+ }
+ }
+
+// m_log.DebugFormat("[OUTBOUND URL FILTER]: Did not find [{0}:{1}] in list", addr, port);
+
+ return false;
+ }
+
+ ///
+ /// Checks whether the given url is allowed by the filter.
+ ///
+ ///
+ public bool CheckAllowed(Uri url)
+ {
+ bool allowed = true;
+
+ // Check that we are permitted to make calls to this endpoint.
+ bool foundIpv4Address = false;
+
+ IPAddress[] addresses = Dns.GetHostAddresses(url.Host);
+
+ foreach (IPAddress addr in addresses)
+ {
+ if (addr.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
+ {
+// m_log.DebugFormat("[OUTBOUND URL FILTER]: Found address [{0}]", addr);
+
+ foundIpv4Address = true;
+
+ // Check blacklist
+ if (OutboundUrlFilter.IsInNetwork(addr, url.Port, m_blacklistNetworks, m_blacklistEndPoints, Name))
+ {
+// m_log.DebugFormat("[OUTBOUND URL FILTER]: Found [{0}] in blacklist for {1}", url, Name);
+
+ // Check blacklist exceptions
+ allowed
+ = OutboundUrlFilter.IsInNetwork(
+ addr, url.Port, m_blacklistExceptionNetworks, m_blacklistExceptionEndPoints, Name);
+
+// if (allowed)
+// m_log.DebugFormat("[OUTBOUND URL FILTER]: Found [{0}] in whitelist for {1}", url, Name);
+ }
+ }
+
+ // Found at least one address in a blacklist and not a blacklist exception
+ if (!allowed)
+ return false;
+// else
+// m_log.DebugFormat("[OUTBOUND URL FILTER]: URL [{0}] not in blacklist for {1}", url, Name);
+ }
+
+ // We do not know how to handle IPv6 securely yet.
+ if (!foundIpv4Address)
+ return false;
+
+// m_log.DebugFormat("[OUTBOUND URL FILTER]: Allowing request [{0}]", url);
+
+ return allowed;
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenSim/Framework/RestClient.cs b/OpenSim/Framework/RestClient.cs
new file mode 100644
index 0000000..7080ca5
--- /dev/null
+++ b/OpenSim/Framework/RestClient.cs
@@ -0,0 +1,676 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Net;
+using System.Reflection;
+using System.Text;
+using System.Threading;
+using System.Web;
+using log4net;
+
+using OpenSim.Framework.ServiceAuth;
+
+namespace OpenSim.Framework
+{
+ ///
+ /// Implementation of a generic REST client
+ ///
+ ///
+ /// This class is a generic implementation of a REST (Representational State Transfer) web service. This
+ /// class is designed to execute both synchronously and asynchronously.
+ ///
+ /// Internally the implementation works as a two stage asynchronous web-client.
+ /// When the request is initiated, RestClient will query asynchronously for for a web-response,
+ /// sleeping until the initial response is returned by the server. Once the initial response is retrieved
+ /// the second stage of asynchronous requests will be triggered, in an attempt to read of the response
+ /// object into a memorystream as a sequence of asynchronous reads.
+ ///
+ /// The asynchronisity of RestClient is designed to move as much processing into the back-ground, allowing
+ /// other threads to execute, while it waits for a response from the web-service. RestClient itself can be
+ /// invoked by the caller in either synchronous mode or asynchronous modes.
+ ///
+ public class RestClient : IDisposable
+ {
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ // private string realuri;
+
+ #region member variables
+
+ ///
+ /// The base Uri of the web-service e.g. http://www.google.com
+ ///
+ private string _url;
+
+ ///
+ /// Path elements of the query
+ ///
+ private List _pathElements = new List();
+
+ ///
+ /// Parameter elements of the query, e.g. min=34
+ ///
+ private Dictionary _parameterElements = new Dictionary();
+
+ ///
+ /// Request method. E.g. GET, POST, PUT or DELETE
+ ///
+ private string _method;
+
+ ///
+ /// Temporary buffer used to store bytes temporarily as they come in from the server
+ ///
+ private byte[] _readbuf;
+
+ ///
+ /// MemoryStream representing the resulting resource
+ ///
+ private Stream _resource;
+
+ ///
+ /// WebRequest object, held as a member variable
+ ///
+ private HttpWebRequest _request;
+
+ ///
+ /// WebResponse object, held as a member variable, so we can close it
+ ///
+ private HttpWebResponse _response;
+
+ ///
+ /// This flag will help block the main synchroneous method, in case we run in synchroneous mode
+ ///
+ //public static ManualResetEvent _allDone = new ManualResetEvent(false);
+
+ ///
+ /// Default time out period
+ ///
+ //private const int DefaultTimeout = 10*1000; // 10 seconds timeout
+
+ ///
+ /// Default Buffer size of a block requested from the web-server
+ ///
+ private const int BufferSize = 4096; // Read blocks of 4 KB.
+
+
+ ///
+ /// if an exception occours during async processing, we need to save it, so it can be
+ /// rethrown on the primary thread;
+ ///
+ private Exception _asyncException;
+
+ #endregion member variables
+
+ #region constructors
+
+ ///
+ /// Instantiate a new RestClient
+ ///
+ /// Web-service to query, e.g. http://osgrid.org:8003
+ public RestClient(string url)
+ {
+ _url = url;
+ _readbuf = new byte[BufferSize];
+ _resource = new MemoryStream();
+ _request = null;
+ _response = null;
+ _lock = new object();
+ }
+
+ private object _lock;
+
+ #endregion constructors
+
+
+ #region Dispose
+
+ private bool disposed = false;
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposed)
+ return;
+
+ if (disposing)
+ {
+ _resource.Dispose();
+ }
+
+ disposed = true;
+ }
+
+ #endregion Dispose
+
+
+ ///
+ /// Add a path element to the query, e.g. assets
+ ///
+ /// path entry
+ public void AddResourcePath(string element)
+ {
+ if (isSlashed(element))
+ _pathElements.Add(element.Substring(0, element.Length - 1));
+ else
+ _pathElements.Add(element);
+ }
+
+ ///
+ /// Add a query parameter to the Url
+ ///
+ /// Name of the parameter, e.g. min
+ /// Value of the parameter, e.g. 42
+ public void AddQueryParameter(string name, string value)
+ {
+ try
+ {
+ _parameterElements.Add(HttpUtility.UrlEncode(name), HttpUtility.UrlEncode(value));
+ }
+ catch (ArgumentException)
+ {
+ m_log.Error("[REST]: Query parameter " + name + " is already added.");
+ }
+ catch (Exception e)
+ {
+ m_log.Error("[REST]: An exception was raised adding query parameter to dictionary. Exception: {0}",e);
+ }
+ }
+
+ ///
+ /// Add a query parameter to the Url
+ ///
+ /// Name of the parameter, e.g. min
+ public void AddQueryParameter(string name)
+ {
+ try
+ {
+ _parameterElements.Add(HttpUtility.UrlEncode(name), null);
+ }
+ catch (ArgumentException)
+ {
+ m_log.Error("[REST]: Query parameter " + name + " is already added.");
+ }
+ catch (Exception e)
+ {
+ m_log.Error("[REST]: An exception was raised adding query parameter to dictionary. Exception: {0}",e);
+ }
+ }
+
+ ///
+ /// Web-Request method, e.g. GET, PUT, POST, DELETE
+ ///
+ public string RequestMethod
+ {
+ get { return _method; }
+ set { _method = value; }
+ }
+
+ ///
+ /// True if string contains a trailing slash '/'
+ ///
+ /// string to be examined
+ /// true if slash is present
+ private static bool isSlashed(string s)
+ {
+ return s.Substring(s.Length - 1, 1) == "/";
+ }
+
+ ///
+ /// Build a Uri based on the initial Url, path elements and parameters
+ ///
+ /// fully constructed Uri
+ private Uri buildUri()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append(_url);
+
+ foreach (string e in _pathElements)
+ {
+ sb.Append("/");
+ sb.Append(e);
+ }
+
+ bool firstElement = true;
+ foreach (KeyValuePair kv in _parameterElements)
+ {
+ if (firstElement)
+ {
+ sb.Append("?");
+ firstElement = false;
+ }
+ else
+ sb.Append("&");
+
+ sb.Append(kv.Key);
+ if (!string.IsNullOrEmpty(kv.Value))
+ {
+ sb.Append("=");
+ sb.Append(kv.Value);
+ }
+ }
+ // realuri = sb.ToString();
+ //m_log.InfoFormat("[REST CLIENT]: RestURL: {0}", realuri);
+ return new Uri(sb.ToString());
+ }
+
+ #region Async communications with server
+
+ ///
+ /// Async method, invoked when a block of data has been received from the service
+ ///
+ ///
+ private void StreamIsReadyDelegate(IAsyncResult ar)
+ {
+ try
+ {
+ Stream s = (Stream) ar.AsyncState;
+ int read = s.EndRead(ar);
+
+ if (read > 0)
+ {
+ _resource.Write(_readbuf, 0, read);
+ // IAsyncResult asynchronousResult =
+ // s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s);
+ s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s);
+
+ // TODO! Implement timeout, without killing the server
+ //ThreadPool.RegisterWaitForSingleObject(asynchronousResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
+ }
+ else
+ {
+ s.Close();
+ //_allDone.Set();
+ }
+ }
+ catch (Exception e)
+ {
+ //_allDone.Set();
+ _asyncException = e;
+ }
+ }
+
+ #endregion Async communications with server
+
+ ///
+ /// Perform a synchronous request
+ ///
+ public Stream Request()
+ {
+ return Request(null);
+ }
+
+ ///
+ /// Perform a synchronous request
+ ///
+ public Stream Request(IServiceAuth auth)
+ {
+ lock (_lock)
+ {
+ _request = (HttpWebRequest) WebRequest.Create(buildUri());
+ _request.KeepAlive = false;
+ _request.ContentType = "application/xml";
+ _request.Timeout = 200000;
+ _request.Method = RequestMethod;
+ _asyncException = null;
+ if (auth != null)
+ auth.AddAuthorization(_request.Headers);
+
+ int reqnum = WebUtil.RequestNumber++;
+ if (WebUtil.DebugLevel >= 3)
+ m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} REST {1} to {2}", reqnum, _request.Method, _request.RequestUri);
+
+// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
+
+ try
+ {
+ using (_response = (HttpWebResponse) _request.GetResponse())
+ {
+ using (Stream src = _response.GetResponseStream())
+ {
+ int length = src.Read(_readbuf, 0, BufferSize);
+ while (length > 0)
+ {
+ _resource.Write(_readbuf, 0, length);
+ length = src.Read(_readbuf, 0, BufferSize);
+ }
+
+ // TODO! Implement timeout, without killing the server
+ // this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted
+ //ThreadPool.RegisterWaitForSingleObject(responseAsyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
+
+ // _allDone.WaitOne();
+ }
+ }
+ }
+ catch (WebException e)
+ {
+ using (HttpWebResponse errorResponse = e.Response as HttpWebResponse)
+ {
+ if (null != errorResponse && HttpStatusCode.NotFound == errorResponse.StatusCode)
+ {
+ // This is often benign. E.g., requesting a missing asset will return 404.
+ m_log.DebugFormat("[REST CLIENT] Resource not found (404): {0}", _request.Address.ToString());
+ }
+ else
+ {
+ m_log.Error(string.Format("[REST CLIENT] Error fetching resource from server: {0} ", _request.Address.ToString()), e);
+ }
+ }
+
+ return null;
+ }
+
+ if (_asyncException != null)
+ throw _asyncException;
+
+ if (_resource != null)
+ {
+ _resource.Flush();
+ _resource.Seek(0, SeekOrigin.Begin);
+ }
+
+ if (WebUtil.DebugLevel >= 5)
+ WebUtil.LogResponseDetail(reqnum, _resource);
+
+ return _resource;
+ }
+ }
+
+ public Stream Request(Stream src, IServiceAuth auth)
+ {
+ _request = (HttpWebRequest) WebRequest.Create(buildUri());
+ _request.KeepAlive = false;
+ _request.ContentType = "application/xml";
+ _request.Timeout = 900000;
+ _request.Method = RequestMethod;
+ _asyncException = null;
+ _request.ContentLength = src.Length;
+ if (auth != null)
+ auth.AddAuthorization(_request.Headers);
+
+ src.Seek(0, SeekOrigin.Begin);
+
+ int reqnum = WebUtil.RequestNumber++;
+ if (WebUtil.DebugLevel >= 3)
+ m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} REST {1} to {2}", reqnum, _request.Method, _request.RequestUri);
+ if (WebUtil.DebugLevel >= 5)
+ WebUtil.LogOutgoingDetail(string.Format("SEND {0}: ", reqnum), src);
+
+ Stream dst = _request.GetRequestStream();
+
+ byte[] buf = new byte[1024];
+ int length = src.Read(buf, 0, 1024);
+ while (length > 0)
+ {
+ dst.Write(buf, 0, length);
+ length = src.Read(buf, 0, 1024);
+ }
+
+ try
+ {
+ _response = (HttpWebResponse)_request.GetResponse();
+ }
+ catch (WebException e)
+ {
+ m_log.WarnFormat("[REST]: Request {0} {1} failed with status {2} and message {3}",
+ RequestMethod, _request.RequestUri, e.Status, e.Message);
+ return null;
+ }
+ catch (Exception e)
+ {
+ m_log.WarnFormat(
+ "[REST]: Request {0} {1} failed with exception {2} {3}",
+ RequestMethod, _request.RequestUri, e.Message, e.StackTrace);
+ return null;
+ }
+
+ if (WebUtil.DebugLevel >= 5)
+ {
+ using (Stream responseStream = _response.GetResponseStream())
+ {
+ using (StreamReader reader = new StreamReader(responseStream))
+ {
+ string responseStr = reader.ReadToEnd();
+ WebUtil.LogResponseDetail(reqnum, responseStr);
+ }
+ }
+ }
+
+ _response.Close();
+
+// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
+
+ // TODO! Implement timeout, without killing the server
+ // this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted
+ //ThreadPool.RegisterWaitForSingleObject(responseAsyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
+
+ return null;
+ }
+
+ #region Async Invocation
+
+ public IAsyncResult BeginRequest(AsyncCallback callback, object state)
+ {
+ ///
+ /// In case, we are invoked asynchroneously this object will keep track of the state
+ ///
+ AsyncResult ar = new AsyncResult(callback, state);
+ Util.FireAndForget(RequestHelper, ar, "RestClient.BeginRequest");
+ return ar;
+ }
+
+ public Stream EndRequest(IAsyncResult asyncResult)
+ {
+ AsyncResult ar = (AsyncResult) asyncResult;
+
+ // Wait for operation to complete, then return result or
+ // throw exception
+ return ar.EndInvoke();
+ }
+
+ private void RequestHelper(Object asyncResult)
+ {
+ // We know that it's really an AsyncResult object
+ AsyncResult ar = (AsyncResult) asyncResult;
+ try
+ {
+ // Perform the operation; if sucessful set the result
+ Stream s = Request(null);
+ ar.SetAsCompleted(s, false);
+ }
+ catch (Exception e)
+ {
+ // If operation fails, set the exception
+ ar.HandleException(e, false);
+ }
+ }
+
+ #endregion Async Invocation
+ }
+
+ internal class SimpleAsyncResult : IAsyncResult
+ {
+ private readonly AsyncCallback m_callback;
+
+ ///
+ /// Is process completed?
+ ///
+ /// Should really be boolean, but VolatileRead has no boolean method
+ private byte m_completed;
+
+ ///
+ /// Did process complete synchronously?
+ ///
+ /// I have a hard time imagining a scenario where this is the case, again, same issue about
+ /// booleans and VolatileRead as m_completed
+ ///
+ private byte m_completedSynchronously;
+
+ private readonly object m_asyncState;
+ private ManualResetEvent m_waitHandle;
+ private Exception m_exception;
+
+ internal SimpleAsyncResult(AsyncCallback cb, object state)
+ {
+ m_callback = cb;
+ m_asyncState = state;
+ m_completed = 0;
+ m_completedSynchronously = 1;
+ }
+
+ #region IAsyncResult Members
+
+ public object AsyncState
+ {
+ get { return m_asyncState; }
+ }
+
+ public WaitHandle AsyncWaitHandle
+ {
+ get
+ {
+ if (m_waitHandle == null)
+ {
+ bool done = IsCompleted;
+ ManualResetEvent mre = new ManualResetEvent(done);
+ if (Interlocked.CompareExchange(ref m_waitHandle, mre, null) != null)
+ {
+ mre.Close();
+ }
+ else
+ {
+ if (!done && IsCompleted)
+ {
+ m_waitHandle.Set();
+ }
+ }
+ }
+
+ return m_waitHandle;
+ }
+ }
+
+
+ public bool CompletedSynchronously
+ {
+ get { return Thread.VolatileRead(ref m_completedSynchronously) == 1; }
+ }
+
+
+ public bool IsCompleted
+ {
+ get { return Thread.VolatileRead(ref m_completed) == 1; }
+ }
+
+ #endregion
+
+ #region class Methods
+
+ internal void SetAsCompleted(bool completedSynchronously)
+ {
+ m_completed = 1;
+ if (completedSynchronously)
+ m_completedSynchronously = 1;
+ else
+ m_completedSynchronously = 0;
+
+ SignalCompletion();
+ }
+
+ internal void HandleException(Exception e, bool completedSynchronously)
+ {
+ m_completed = 1;
+ if (completedSynchronously)
+ m_completedSynchronously = 1;
+ else
+ m_completedSynchronously = 0;
+ m_exception = e;
+
+ SignalCompletion();
+ }
+
+ private void SignalCompletion()
+ {
+ if (m_waitHandle != null) m_waitHandle.Set();
+
+ if (m_callback != null) m_callback(this);
+ }
+
+ public void EndInvoke()
+ {
+ // This method assumes that only 1 thread calls EndInvoke
+ if (!IsCompleted)
+ {
+ // If the operation isn't done, wait for it
+ AsyncWaitHandle.WaitOne();
+ AsyncWaitHandle.Close();
+ m_waitHandle.Close();
+ m_waitHandle = null; // Allow early GC
+ }
+
+ // Operation is done: if an exception occured, throw it
+ if (m_exception != null) throw m_exception;
+ }
+
+ #endregion
+ }
+
+ internal class AsyncResult : SimpleAsyncResult
+ {
+ private T m_result = default(T);
+
+ public AsyncResult(AsyncCallback asyncCallback, Object state) :
+ base(asyncCallback, state)
+ {
+ }
+
+ public void SetAsCompleted(T result, bool completedSynchronously)
+ {
+ // Save the asynchronous operation's result
+ m_result = result;
+
+ // Tell the base class that the operation completed
+ // sucessfully (no exception)
+ base.SetAsCompleted(completedSynchronously);
+ }
+
+ public new T EndInvoke()
+ {
+ base.EndInvoke();
+ return m_result;
+ }
+ }
+
+}
\ No newline at end of file
--
cgit v1.1
From 5bfc2743c68a74ad59d9ae5e3e73fef58e17bf89 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sat, 5 Sep 2015 15:20:32 -0700
Subject: Deleted unused file.
---
OpenSim/Framework/ForeignUserProfileData.cs | 77 -----------------------------
1 file changed, 77 deletions(-)
delete mode 100644 OpenSim/Framework/ForeignUserProfileData.cs
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/ForeignUserProfileData.cs b/OpenSim/Framework/ForeignUserProfileData.cs
deleted file mode 100644
index 2beaf80..0000000
--- a/OpenSim/Framework/ForeignUserProfileData.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-
-namespace OpenSim.Framework
-{
- public class ForeignUserProfileData : UserProfileData
- {
- ///
- /// The address of the users home sim, used for foreigners.
- ///
- private string _userUserServerURI = String.Empty;
-
- ///
- /// The address of the users home sim, used for foreigners.
- ///
- private string _userHomeAddress = String.Empty;
-
- ///
- /// The port of the users home sim, used for foreigners.
- ///
- private string _userHomePort = String.Empty;
- ///
- /// The remoting port of the users home sim, used for foreigners.
- ///
- private string _userHomeRemotingPort = String.Empty;
-
- public string UserServerURI
- {
- get { return _userUserServerURI; }
- set { _userUserServerURI = value; }
- }
-
- public string UserHomeAddress
- {
- get { return _userHomeAddress; }
- set { _userHomeAddress = value; }
- }
-
- public string UserHomePort
- {
- get { return _userHomePort; }
- set { _userHomePort = value; }
- }
-
- public string UserHomeRemotingPort
- {
- get { return _userHomeRemotingPort; }
- set { _userHomeRemotingPort = value; }
- }
- }
-}
--
cgit v1.1
From 3cf07564b6d4e72f6193f5affdcb0dc14624991a Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sat, 5 Sep 2015 17:37:07 -0700
Subject: Moved the two region loaders into the RegionLoaderPlugin dll,
therefore eliminating 2 top-level dlls that didn't make much sense.
---
OpenSim/Framework/IRegionLoader.cs | 37 ------
.../Filesystem/RegionLoaderFileSystem.cs | 116 ----------------
.../RegionLoader/Web/RegionLoaderWebServer.cs | 147 ---------------------
3 files changed, 300 deletions(-)
delete mode 100644 OpenSim/Framework/IRegionLoader.cs
delete mode 100644 OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs
delete mode 100644 OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/IRegionLoader.cs b/OpenSim/Framework/IRegionLoader.cs
deleted file mode 100644
index c566fc7..0000000
--- a/OpenSim/Framework/IRegionLoader.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using Nini.Config;
-
-namespace OpenSim.Framework
-{
- public interface IRegionLoader
- {
- void SetIniConfigSource(IConfigSource configSource);
- RegionInfo[] LoadRegions();
- }
-}
\ No newline at end of file
diff --git a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs
deleted file mode 100644
index 8332c14..0000000
--- a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using log4net;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Reflection;
-using Nini.Config;
-
-namespace OpenSim.Framework.RegionLoader.Filesystem
-{
- public class RegionLoaderFileSystem : IRegionLoader
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- private IConfigSource m_configSource;
-
- public void SetIniConfigSource(IConfigSource configSource)
- {
- m_configSource = configSource;
- }
-
- public RegionInfo[] LoadRegions()
- {
- string regionConfigPath = Path.Combine(Util.configDir(), "Regions");
- bool allowRegionless = false;
-
- try
- {
- IConfig startupConfig = (IConfig)m_configSource.Configs["Startup"];
- regionConfigPath = startupConfig.GetString("regionload_regionsdir", regionConfigPath).Trim();
- allowRegionless = startupConfig.GetBoolean("allow_regionless", false);
- }
- catch (Exception)
- {
- // No INI setting recorded.
- }
-
- if (!Directory.Exists(regionConfigPath))
- {
- Directory.CreateDirectory(regionConfigPath);
- }
-
- string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml");
- string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini");
-
- // Create an empty Regions.ini if there are no existing config files.
- if (!allowRegionless && configFiles.Length == 0 && iniFiles.Length == 0)
- {
- new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "Regions.ini"), false, m_configSource);
- iniFiles = Directory.GetFiles(regionConfigPath, "*.ini");
- }
-
- m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config files from {0}", regionConfigPath);
-
- List regionInfos = new List();
-
- int i = 0;
- foreach (string file in iniFiles)
- {
- m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file);
-
- IConfigSource source = new IniConfigSource(file);
-
- foreach (IConfig config in source.Configs)
- {
- RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name);
- regionInfos.Add(regionInfo);
-
- m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName);
-
- i++;
- }
- }
-
- foreach (string file in configFiles)
- {
- m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file);
-
- RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource);
- regionInfos.Add(regionInfo);
-
- m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName);
-
- i++;
- }
-
- return regionInfos.ToArray();
- }
- }
-}
\ No newline at end of file
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
deleted file mode 100644
index f60bb12..0000000
--- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.IO;
-using System.Net;
-using System.Reflection;
-using System.Xml;
-using log4net;
-using Nini.Config;
-
-namespace OpenSim.Framework.RegionLoader.Web
-{
- public class RegionLoaderWebServer : IRegionLoader
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- private IConfigSource m_configSource;
-
- public void SetIniConfigSource(IConfigSource configSource)
- {
- m_configSource = configSource;
- }
-
- public RegionInfo[] LoadRegions()
- {
- if (m_configSource == null)
- {
- m_log.Error("[WEBLOADER]: Unable to load configuration source!");
- return null;
- }
- else
- {
- IConfig startupConfig = (IConfig) m_configSource.Configs["Startup"];
- string url = startupConfig.GetString("regionload_webserver_url", String.Empty).Trim();
- bool allowRegionless = startupConfig.GetBoolean("allow_regionless", false);
-
- if (url == String.Empty)
- {
- m_log.Error("[WEBLOADER]: Unable to load webserver URL - URL was empty.");
- return null;
- }
- else
- {
- RegionInfo[] regionInfos = new RegionInfo[] {};
- int regionCount = 0;
- HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url);
- webRequest.Timeout = 30000; //30 Second Timeout
- m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url);
-
- try
- {
- string xmlSource = String.Empty;
-
- using (HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse())
- {
- m_log.Debug("[WEBLOADER]: Downloading region information...");
-
- using (Stream s = webResponse.GetResponseStream())
- {
- using (StreamReader reader = new StreamReader(s))
- {
- string tempStr = reader.ReadLine();
- while (tempStr != null)
- {
- xmlSource = xmlSource + tempStr;
- tempStr = reader.ReadLine();
- }
- }
- }
- }
-
- m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
- xmlSource.Length);
- XmlDocument xmlDoc = new XmlDocument();
- xmlDoc.LoadXml(xmlSource);
- if (xmlDoc.FirstChild.Name == "Nini")
- {
- regionCount = xmlDoc.FirstChild.ChildNodes.Count;
-
- if (regionCount > 0)
- {
- regionInfos = new RegionInfo[regionCount];
- int i;
- for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++)
- {
- m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
- regionInfos[i] =
- new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource);
- }
- }
- }
- }
- catch (WebException ex)
- {
- using (HttpWebResponse response = (HttpWebResponse)ex.Response)
- {
- if (response.StatusCode == HttpStatusCode.NotFound)
- {
- if (!allowRegionless)
- throw ex;
- }
- else
- {
- throw ex;
- }
- }
- }
-
- if (regionCount > 0 | allowRegionless)
- {
- return regionInfos;
- }
- else
- {
- m_log.Error("[WEBLOADER]: No region configs were available.");
- return null;
- }
- }
- }
- }
- }
-}
--
cgit v1.1
From f928d41a275daf661a4d0df0e6bebd33a52d79a6 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sat, 5 Sep 2015 17:40:27 -0700
Subject: Amend to previous commit: delete the corresponding AssemblyInfo's
---
.../Filesystem/Properties/AssemblyInfo.cs | 33 ----------------------
.../RegionLoader/Web/Properties/AssemblyInfo.cs | 33 ----------------------
2 files changed, 66 deletions(-)
delete mode 100644 OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs
delete mode 100644 OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs b/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs
deleted file mode 100644
index 3bcbe2f..0000000
--- a/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("OpenSim.Framework.RegionLoader.Filesystem")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("http://opensimulator.org")]
-[assembly: AssemblyProduct("OpenSim")]
-[assembly: AssemblyCopyright("OpenSimulator developers")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("4ab5c74b-e886-40a1-b67d-a04df285e706")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-[assembly: AssemblyVersion("0.8.2.*")]
-
diff --git a/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs b/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs
deleted file mode 100644
index 1b2519c..0000000
--- a/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("OpenSim.Framework.RegionLoader.Web")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("http://opensimulator.org")]
-[assembly: AssemblyProduct("OpenSim")]
-[assembly: AssemblyCopyright("OpenSimulator developers")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("985afff8-e7ed-4056-acce-39abf7a43d33")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-[assembly: AssemblyVersion("0.8.2.*")]
-
--
cgit v1.1