Merge branch 'master' into careminster

Conflicts:
	OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
	OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
	OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
avinationmerge
Melanie 2013-02-27 18:05:04 +00:00
commit 578174d21c
22 changed files with 312 additions and 219 deletions

View File

@ -44,7 +44,6 @@ namespace OpenSim.ConsoleClient
ReplyDelegate action) ReplyDelegate action)
{ {
WebRequest request = WebRequest.Create(requestUrl); WebRequest request = WebRequest.Create(requestUrl);
WebResponse response = null;
request.Method = "POST"; request.Method = "POST";
@ -64,17 +63,19 @@ namespace OpenSim.ConsoleClient
{ {
string reply = String.Empty; string reply = String.Empty;
response = request.EndGetResponse(ar); using (WebResponse response = request.EndGetResponse(ar))
{
try try
{ {
StreamReader r = new StreamReader(response.GetResponseStream()); using (Stream s = response.GetResponseStream())
using (StreamReader r = new StreamReader(s))
reply = r.ReadToEnd(); reply = r.ReadToEnd();
} }
catch (System.InvalidOperationException) catch (System.InvalidOperationException)
{ {
} }
}
action(requestUrl, data, reply); action(requestUrl, data, reply);
}, null); }, null);

View File

@ -65,10 +65,10 @@ namespace OpenSim.Framework.Configuration.HTTP
byte[] buf = new byte[8192]; byte[] buf = new byte[8192];
HttpWebRequest request = HttpWebRequest request =
(HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName); (HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName);
HttpWebResponse response = (HttpWebResponse) request.GetResponse(); using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
Stream resStream = response.GetResponseStream(); using (Stream resStream = response.GetResponseStream())
{
string tempString = null; string tempString = null;
int count = 0; int count = 0;
@ -80,9 +80,13 @@ namespace OpenSim.Framework.Configuration.HTTP
tempString = Util.UTF8.GetString(buf, 0, count); tempString = Util.UTF8.GetString(buf, 0, count);
sb.Append(tempString); sb.Append(tempString);
} }
} while (count > 0); }
while (count > 0);
LoadDataFromString(sb.ToString()); LoadDataFromString(sb.ToString());
} }
}
}
catch (WebException) catch (WebException)
{ {
m_log.Warn("Unable to connect to remote configuration file (" + m_log.Warn("Unable to connect to remote configuration file (" +

View File

@ -101,20 +101,11 @@ namespace OpenSim.Framework.Servers.HttpServer
using (WebResponse resp = request.GetResponse()) using (WebResponse resp = request.GetResponse())
{ {
XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
Stream respStream = null;
try using (Stream respStream = resp.GetResponseStream())
{
respStream = resp.GetResponseStream();
deserial = (TResponse)deserializer.Deserialize(respStream); deserial = (TResponse)deserializer.Deserialize(respStream);
} }
catch { }
finally
{
if (respStream != null)
respStream.Close();
resp.Close();
}
}
return deserial; return deserial;
} }
} }

View File

@ -228,7 +228,7 @@ namespace OpenSim.Framework
errorMessage = we.Message; errorMessage = we.Message;
if (we.Status == WebExceptionStatus.ProtocolError) if (we.Status == WebExceptionStatus.ProtocolError)
{ {
HttpWebResponse webResponse = (HttpWebResponse)we.Response; using (HttpWebResponse webResponse = (HttpWebResponse)we.Response)
errorMessage = String.Format("[{0}] {1}", webResponse.StatusCode, webResponse.StatusDescription); errorMessage = String.Format("[{0}] {1}", webResponse.StatusCode, webResponse.StatusDescription);
} }
} }
@ -388,7 +388,7 @@ namespace OpenSim.Framework
errorMessage = we.Message; errorMessage = we.Message;
if (we.Status == WebExceptionStatus.ProtocolError) if (we.Status == WebExceptionStatus.ProtocolError)
{ {
HttpWebResponse webResponse = (HttpWebResponse)we.Response; using (HttpWebResponse webResponse = (HttpWebResponse)we.Response)
errorMessage = String.Format("[{0}] {1}",webResponse.StatusCode,webResponse.StatusDescription); errorMessage = String.Format("[{0}] {1}",webResponse.StatusCode,webResponse.StatusDescription);
} }
} }
@ -837,8 +837,8 @@ namespace OpenSim.Framework
{ {
if (e.Response is HttpWebResponse) if (e.Response is HttpWebResponse)
{ {
HttpWebResponse httpResponse = (HttpWebResponse)e.Response; using (HttpWebResponse httpResponse = (HttpWebResponse)e.Response)
{
if (httpResponse.StatusCode != HttpStatusCode.NotFound) if (httpResponse.StatusCode != HttpStatusCode.NotFound)
{ {
// We don't appear to be handling any other status codes, so log these feailures to that // We don't appear to be handling any other status codes, so log these feailures to that
@ -849,6 +849,7 @@ namespace OpenSim.Framework
} }
} }
} }
}
else else
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
@ -995,12 +996,10 @@ namespace OpenSim.Framework
Stream respStream = null; Stream respStream = null;
try try
{ {
respStream = resp.GetResponseStream(); using (respStream = resp.GetResponseStream())
using (StreamReader reader = new StreamReader(respStream)) using (StreamReader reader = new StreamReader(respStream))
{
respstring = reader.ReadToEnd(); respstring = reader.ReadToEnd();
} }
}
catch (Exception e) catch (Exception e)
{ {
m_log.DebugFormat( m_log.DebugFormat(
@ -1142,10 +1141,11 @@ namespace OpenSim.Framework
{ {
if (resp.ContentLength != 0) if (resp.ContentLength != 0)
{ {
Stream respStream = resp.GetResponseStream(); using (Stream respStream = resp.GetResponseStream())
{
XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
deserial = (TResponse)deserializer.Deserialize(respStream); deserial = (TResponse)deserializer.Deserialize(respStream);
respStream.Close(); }
} }
else else
{ {
@ -1157,8 +1157,8 @@ namespace OpenSim.Framework
} }
catch (WebException e) catch (WebException e)
{ {
HttpWebResponse hwr = (HttpWebResponse)e.Response; using (HttpWebResponse hwr = (HttpWebResponse)e.Response)
{
if (hwr != null && hwr.StatusCode == HttpStatusCode.NotFound) if (hwr != null && hwr.StatusCode == HttpStatusCode.NotFound)
return deserial; return deserial;
else else
@ -1166,6 +1166,7 @@ namespace OpenSim.Framework
"[SynchronousRestObjectRequester]: WebException for {0} {1} {2}: {3} {4}", "[SynchronousRestObjectRequester]: WebException for {0} {1} {2}: {3} {4}",
verb, requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace); verb, requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace);
} }
}
catch (System.InvalidOperationException) catch (System.InvalidOperationException)
{ {
// This is what happens when there is invalid XML // This is what happens when there is invalid XML

View File

@ -88,15 +88,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
/// </summary> /// </summary>
private int m_TotalUrls = 15000; private int m_TotalUrls = 15000;
private uint https_port = 0; private uint m_HttpsPort = 0;
private IHttpServer m_HttpServer = null; private IHttpServer m_HttpServer = null;
private IHttpServer m_HttpsServer = null; private IHttpServer m_HttpsServer = null;
private string m_ExternalHostNameForLSL = ""; public string ExternalHostNameForLSL { get; private set; }
public string ExternalHostNameForLSL
{
get { return m_ExternalHostNameForLSL; }
}
public Type ReplaceableInterface public Type ReplaceableInterface
{ {
@ -110,13 +106,21 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
public void Initialise(IConfigSource config) public void Initialise(IConfigSource config)
{ {
m_ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", System.Environment.MachineName); IConfig networkConfig = config.Configs["Network"];
bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener",false);
if (ssl_enabled) if (networkConfig != null)
{ {
https_port = (uint) config.Configs["Network"].GetInt("https_port",0); ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", null);
bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener", false);
if (ssl_enabled)
m_HttpsPort = (uint)config.Configs["Network"].GetInt("https_port", (int)m_HttpsPort);
} }
if (ExternalHostNameForLSL == null)
ExternalHostNameForLSL = System.Environment.MachineName;
IConfig llFunctionsConfig = config.Configs["LL-Functions"]; IConfig llFunctionsConfig = config.Configs["LL-Functions"];
if (llFunctionsConfig != null) if (llFunctionsConfig != null)
@ -136,9 +140,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
m_HttpServer = MainServer.Instance; m_HttpServer = MainServer.Instance;
// //
// We can use the https if it is enabled // We can use the https if it is enabled
if (https_port > 0) if (m_HttpsPort > 0)
{ {
m_HttpsServer = MainServer.GetHttpServer(https_port); m_HttpsServer = MainServer.GetHttpServer(m_HttpsPort);
} }
} }
@ -176,7 +180,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
return urlcode; return urlcode;
} }
string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString(); string url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString();
UrlData urlData = new UrlData(); UrlData urlData = new UrlData();
urlData.hostID = host.UUID; urlData.hostID = host.UUID;
@ -221,7 +225,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
return urlcode; return urlcode;
} }
string url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString(); string url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString();
UrlData urlData = new UrlData(); UrlData urlData = new UrlData();
urlData.hostID = host.UUID; urlData.hostID = host.UUID;
@ -542,7 +546,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
{ {
Hashtable headers = (Hashtable)request["headers"]; Hashtable headers = (Hashtable)request["headers"];
// string uri_full = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri;// "/lslhttp/" + urlcode.ToString() + "/"; // string uri_full = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri;// "/lslhttp/" + urlcode.ToString() + "/";
int pos1 = uri.IndexOf("/");// /lslhttp int pos1 = uri.IndexOf("/");// /lslhttp
int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/ int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/
@ -558,10 +562,10 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
UrlData url = null; UrlData url = null;
string urlkey; string urlkey;
if (!is_ssl) if (!is_ssl)
urlkey = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp; urlkey = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp;
//m_UrlMap[]; //m_UrlMap[];
else else
urlkey = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp; urlkey = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp;
if (m_UrlMap.ContainsKey(urlkey)) if (m_UrlMap.ContainsKey(urlkey))
{ {

View File

@ -838,15 +838,19 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
try try
{ {
WebRequest request = HttpWebRequest.Create(url); WebRequest request = HttpWebRequest.Create(url);
//Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used.
//Ckrinke Stream str = null; using (HttpWebResponse response = (HttpWebResponse)(request).GetResponse())
HttpWebResponse response = (HttpWebResponse)(request).GetResponse(); {
if (response.StatusCode == HttpStatusCode.OK) if (response.StatusCode == HttpStatusCode.OK)
{ {
Bitmap image = new Bitmap(response.GetResponseStream()); using (Stream s = response.GetResponseStream())
{
Bitmap image = new Bitmap(s);
return image; return image;
} }
} }
}
}
catch { } catch { }
return null; return null;

View File

@ -52,7 +52,18 @@ namespace OpenSim.Region.Framework.Interfaces
string GetXMLState(UUID itemID); string GetXMLState(UUID itemID);
bool SetXMLState(UUID itemID, string xml); bool SetXMLState(UUID itemID, string xml);
/// <summary>
/// Post a script event to a single script.
/// </summary>
/// <returns>true if the post suceeded, false if it did not</returns>
/// <param name='itemID'>The item ID of the script.</param>
/// <param name='name'>The name of the event.</param>
/// <param name='args'>
/// The arguments of the event. These are in the order in which they appear.
/// e.g. for http_request this will be an object array of key request_id, string method, string body
/// </param>
bool PostScriptEvent(UUID itemID, string name, Object[] args); bool PostScriptEvent(UUID itemID, string name, Object[] args);
bool PostObjectEvent(UUID itemID, string name, Object[] args); bool PostObjectEvent(UUID itemID, string name, Object[] args);
/// <summary> /// <summary>

View File

@ -551,13 +551,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
reqStream.Close(); reqStream.Close();
} }
HttpWebResponse fwdrsp = (HttpWebResponse)forwardreq.GetResponse(); using (HttpWebResponse fwdrsp = (HttpWebResponse)forwardreq.GetResponse())
{
Encoding encoding = Util.UTF8; Encoding encoding = Util.UTF8;
StreamReader fwdresponsestream = new StreamReader(fwdrsp.GetResponseStream(), encoding);
using (Stream s = fwdrsp.GetResponseStream())
{
using (StreamReader fwdresponsestream = new StreamReader(s))
{
fwdresponsestr = fwdresponsestream.ReadToEnd(); fwdresponsestr = fwdresponsestream.ReadToEnd();
fwdresponsecontenttype = fwdrsp.ContentType; fwdresponsecontenttype = fwdrsp.ContentType;
fwdresponsecode = (int)fwdrsp.StatusCode; fwdresponsecode = (int)fwdrsp.StatusCode;
fwdresponsestream.Close(); }
}
}
response["content_type"] = fwdresponsecontenttype; response["content_type"] = fwdresponsecontenttype;
response["str_response_string"] = fwdresponsestr; response["str_response_string"] = fwdresponsestr;

View File

@ -1124,17 +1124,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
// m_log.DebugFormat("[VivoxVoice] Sending request <{0}>", requrl); // m_log.DebugFormat("[VivoxVoice] Sending request <{0}>", requrl);
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl); HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl);
HttpWebResponse rsp = null;
// We are sending just parameters, no content // We are sending just parameters, no content
req.ContentLength = 0; req.ContentLength = 0;
// Send request and retrieve the response // Send request and retrieve the response
rsp = (HttpWebResponse)req.GetResponse(); using (HttpWebResponse rsp = (HttpWebResponse)req.GetResponse())
using (Stream s = rsp.GetResponseStream())
XmlTextReader rdr = new XmlTextReader(rsp.GetResponseStream()); using (XmlTextReader rdr = new XmlTextReader(s))
doc.Load(rdr); doc.Load(rdr);
rdr.Close();
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -1146,17 +1146,25 @@ namespace Nwc.XmlRpc
request.AllowWriteStreamBuffering = true; request.AllowWriteStreamBuffering = true;
request.KeepAlive = !_disableKeepAlive; request.KeepAlive = !_disableKeepAlive;
Stream stream = request.GetRequestStream(); using (Stream stream = request.GetRequestStream())
XmlTextWriter xml = new XmlTextWriter(stream, Encoding.ASCII); {
using (XmlTextWriter xml = new XmlTextWriter(stream, Encoding.ASCII))
{
_serializer.Serialize(xml, this); _serializer.Serialize(xml, this);
xml.Flush(); xml.Flush();
xml.Close(); }
}
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader input = new StreamReader(response.GetResponseStream());
string inputXml = input.ReadToEnd();
XmlRpcResponse resp; XmlRpcResponse resp;
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
using (Stream s = response.GetResponseStream())
{
using (StreamReader input = new StreamReader(s))
{
string inputXml = input.ReadToEnd();
try try
{ {
resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml); resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml);
@ -1166,8 +1174,10 @@ namespace Nwc.XmlRpc
RequestResponse = inputXml; RequestResponse = inputXml;
throw e; throw e;
} }
input.Close(); }
response.Close(); }
}
return resp; return resp;
} }
} }

View File

@ -470,7 +470,7 @@ public class BSPrim : BSPhysObject
// Note that this does not change _mass! // Note that this does not change _mass!
public override void UpdatePhysicalMassProperties(float physMass, bool inWorld) public override void UpdatePhysicalMassProperties(float physMass, bool inWorld)
{ {
if (PhysBody.HasPhysicalBody) if (PhysBody.HasPhysicalBody && PhysShape.HasPhysicalShape)
{ {
if (IsStatic) if (IsStatic)
{ {

View File

@ -1,5 +1,12 @@
CURRENT PRIORITIES CURRENT PRIORITIES
================================================= =================================================
Use the HACD convex hull routine in Bullet rather than the C# version.
Speed up hullifying large meshes.
Enable vehicle border crossings (at least as poorly as ODE)
Terrain skirts
Avatar created in previous region and not new region when crossing border
Vehicle recreated in new sim at small Z value (offset from root value?) (DONE)
Lock axis
Deleting a linkset while standing on the root will leave the physical shape of the root behind. Deleting a linkset while standing on the root will leave the physical shape of the root behind.
Not sure if it is because standing on it. Done with large prim linksets. Not sure if it is because standing on it. Done with large prim linksets.
Vehicle angular vertical attraction Vehicle angular vertical attraction
@ -7,16 +14,11 @@ vehicle angular banking
Center-of-gravity Center-of-gravity
Vehicle angular deflection Vehicle angular deflection
Preferred orientation angular correction fix Preferred orientation angular correction fix
Enable vehicle border crossings (at least as poorly as ODE)
Terrain skirts
Avatar created in previous region and not new region when crossing border
Vehicle recreated in new sim at small Z value (offset from root value?) (DONE)
when should angular and linear motor targets be zeroed? when selected? when should angular and linear motor targets be zeroed? when selected?
Need a vehicle.clear()? Or an 'else' in prestep if not physical. Need a vehicle.clear()? Or an 'else' in prestep if not physical.
Teravus llMoveToTarget script debug Teravus llMoveToTarget script debug
Mixing of hover, buoyancy/gravity, moveToTarget, into one force Mixing of hover, buoyancy/gravity, moveToTarget, into one force
Setting hover height to zero disables hover even if hover flags are on (from SL wiki) Setting hover height to zero disables hover even if hover flags are on (from SL wiki)
Nebadon vehicles turning funny in arena
limitMotorUp calibration (more down?) limitMotorUp calibration (more down?)
llRotLookAt llRotLookAt
llLookAt llLookAt
@ -66,6 +68,8 @@ Vehicle attributes are not restored when a vehicle is rezzed on region creation
GENERAL TODO LIST: GENERAL TODO LIST:
================================================= =================================================
Resitution of a prim works on another prim but not on terrain.
The dropped prim doesn't bounce properly on the terrain.
Add a sanity check for PIDTarget location. Add a sanity check for PIDTarget location.
Level-of-detail for mesh creation. Prims with circular interiors require lod of 32. Level-of-detail for mesh creation. Prims with circular interiors require lod of 32.
Is much saved with lower LODs? At the moment, all set to 32. Is much saved with lower LODs? At the moment, all set to 32.
@ -163,7 +167,6 @@ Create tests for different interface components
Have test objects/scripts measure themselves and turn color if correct/bad Have test objects/scripts measure themselves and turn color if correct/bad
Test functions in SL and calibrate correctness there Test functions in SL and calibrate correctness there
Create auto rezzer and tracker to run through the tests Create auto rezzer and tracker to run through the tests
Use the HACD convex hull routine in Bullet rather than the C# version.
Do we need to do convex hulls all the time? Can complex meshes be left meshes? Do we need to do convex hulls all the time? Can complex meshes be left meshes?
There is some problem with meshes and collisions There is some problem with meshes and collisions
Hulls are not as detailed as meshes. Hulled vehicles insides are different shape. Hulls are not as detailed as meshes. Hulled vehicles insides are different shape.
@ -335,3 +338,4 @@ Avatar standing on a moving object should start to move with the object. (DONE 2
Angular motion around Z moves the vehicle in world Z and not vehicle Z in ODE. Angular motion around Z moves the vehicle in world Z and not vehicle Z in ODE.
Verify that angular motion specified around Z moves in the vehicle coordinates. Verify that angular motion specified around Z moves in the vehicle coordinates.
DONE 20130120: BulletSim properly applies force in vehicle relative coordinates. DONE 20130120: BulletSim properly applies force in vehicle relative coordinates.
Nebadon vehicles turning funny in arena (DONE)

View File

@ -10201,6 +10201,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return UUID.Zero.ToString(); return UUID.Zero.ToString();
} }
} }
public LSL_String llRequestURL() public LSL_String llRequestURL()
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);

View File

@ -73,7 +73,6 @@ namespace OpenSim.Services.Connectors
} }
} }
public virtual string Helo() public virtual string Helo()
{ {
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI);
@ -82,11 +81,13 @@ namespace OpenSim.Services.Connectors
try try
{ {
WebResponse response = req.GetResponse(); using (WebResponse response = req.GetResponse())
{
if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null
return string.Empty; return string.Empty;
return response.Headers.Get("X-Handlers-Provided"); return response.Headers.Get("X-Handlers-Provided");
} }
}
catch (Exception e) catch (Exception e)
{ {
m_log.DebugFormat("[HELO SERVICE]: Unable to perform HELO request to {0}: {1}", m_ServerURI, e.Message); m_log.DebugFormat("[HELO SERVICE]: Unable to perform HELO request to {0}: {1}", m_ServerURI, e.Message);
@ -95,6 +96,5 @@ namespace OpenSim.Services.Connectors
// fail // fail
return string.Empty; return string.Empty;
} }
} }
} }

View File

@ -169,19 +169,20 @@ namespace OpenSim.Services.Connectors.Hypergrid
// Let's wait for the response // Let's wait for the response
//m_log.Info("[USER AGENT CONNECTOR]: Waiting for a reply after DoCreateChildAgentCall"); //m_log.Info("[USER AGENT CONNECTOR]: Waiting for a reply after DoCreateChildAgentCall");
WebResponse webResponse = null;
StreamReader sr = null;
try try
{ {
webResponse = AgentCreateRequest.GetResponse(); using (WebResponse webResponse = AgentCreateRequest.GetResponse())
{
if (webResponse == null) if (webResponse == null)
{ {
m_log.Info("[USER AGENT CONNECTOR]: Null reply on DoCreateChildAgentCall post"); m_log.Info("[USER AGENT CONNECTOR]: Null reply on DoCreateChildAgentCall post");
} }
else else
{ {
using (Stream s = webResponse.GetResponseStream())
sr = new StreamReader(webResponse.GetResponseStream()); {
using (StreamReader sr = new StreamReader(s))
{
string response = sr.ReadToEnd().Trim(); string response = sr.ReadToEnd().Trim();
m_log.InfoFormat("[USER AGENT CONNECTOR]: DoCreateChildAgentCall reply was {0} ", response); m_log.InfoFormat("[USER AGENT CONNECTOR]: DoCreateChildAgentCall reply was {0} ", response);
@ -208,17 +209,15 @@ namespace OpenSim.Services.Connectors.Hypergrid
} }
} }
} }
}
}
}
catch (WebException ex) catch (WebException ex)
{ {
m_log.InfoFormat("[USER AGENT CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", ex.Message); m_log.InfoFormat("[USER AGENT CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", ex.Message);
reason = "Destination did not reply"; reason = "Destination did not reply";
return false; return false;
} }
finally
{
if (sr != null)
sr.Close();
}
return true; return true;

View File

@ -168,10 +168,10 @@ namespace OpenSim.Services.Connectors
// Let's wait for the response // Let's wait for the response
//m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall");
StreamReader sr = null;
try try
{ {
WebResponse webResponse = helloNeighbourRequest.GetResponse(); using (WebResponse webResponse = helloNeighbourRequest.GetResponse())
{
if (webResponse == null) if (webResponse == null)
{ {
m_log.DebugFormat( m_log.DebugFormat(
@ -179,11 +179,16 @@ namespace OpenSim.Services.Connectors
thisRegion.RegionName, region.RegionName); thisRegion.RegionName, region.RegionName);
} }
sr = new StreamReader(webResponse.GetResponseStream()); using (Stream s = webResponse.GetResponseStream())
{
using (StreamReader sr = new StreamReader(s))
{
//reply = sr.ReadToEnd().Trim(); //reply = sr.ReadToEnd().Trim();
sr.ReadToEnd().Trim(); sr.ReadToEnd().Trim();
//m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply);
}
}
}
} }
catch (Exception e) catch (Exception e)
{ {
@ -193,11 +198,6 @@ namespace OpenSim.Services.Connectors
return false; return false;
} }
finally
{
if (sr != null)
sr.Close();
}
return true; return true;
} }

View File

@ -340,7 +340,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
// By appending it to the URL also, we allow caching proxies (squid) to invalidate asset URLs // By appending it to the URL also, we allow caching proxies (squid) to invalidate asset URLs
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl + asset.FullID.ToString()); HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl + asset.FullID.ToString());
HttpWebResponse response = MultipartForm.Post(request, postParameters); using (HttpWebResponse response = MultipartForm.Post(request, postParameters))
{
using (Stream responseStream = response.GetResponseStream()) using (Stream responseStream = response.GetResponseStream())
{ {
string responseStr = null; string responseStr = null;
@ -371,6 +372,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
} }
} }
} }
}
catch (WebException ex) catch (WebException ex)
{ {
errorMessage = ex.Message; errorMessage = ex.Message;
@ -378,6 +380,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to store asset \"{0}\" ({1}, {2}): {3}", m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to store asset \"{0}\" ({1}, {2}): {3}",
asset.Name, asset.ID, asset.Metadata.ContentType, errorMessage); asset.Name, asset.ID, asset.Metadata.ContentType, errorMessage);
return null; return null;
} }

View File

@ -40,10 +40,33 @@ namespace OpenSim.Tests.Common
{ {
public class MockScriptEngine : INonSharedRegionModule, IScriptModule, IScriptEngine public class MockScriptEngine : INonSharedRegionModule, IScriptModule, IScriptEngine
{ {
public IConfigSource ConfigSource { get; private set; }
public IConfig Config { get; private set; }
private Scene m_scene; private Scene m_scene;
/// <summary>
/// Expose posted events to tests.
/// </summary>
public Dictionary<UUID, List<EventParams>> PostedEvents { get; private set; }
/// <summary>
/// A very primitive way of hooking text cose to a posed event.
/// </summary>
/// <remarks>
/// May be replaced with something that uses more original code in the future.
/// </remarks>
public event Action<UUID, EventParams> PostEventHook;
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
ConfigSource = source;
// Can set later on if required
Config = new IniConfig("MockScriptEngine", ConfigSource);
PostedEvents = new Dictionary<UUID, List<EventParams>>();
} }
public void Close() public void Close()
@ -85,7 +108,28 @@ namespace OpenSim.Tests.Common
public bool PostScriptEvent(UUID itemID, string name, object[] args) public bool PostScriptEvent(UUID itemID, string name, object[] args)
{ {
return false; // Console.WriteLine("Posting event {0} for {1}", name, itemID);
EventParams evParams = new EventParams(name, args, null);
List<EventParams> eventsForItem;
if (!PostedEvents.ContainsKey(itemID))
{
eventsForItem = new List<EventParams>();
PostedEvents.Add(itemID, eventsForItem);
}
else
{
eventsForItem = PostedEvents[itemID];
}
eventsForItem.Add(evParams);
if (PostEventHook != null)
PostEventHook(itemID, evParams);
return true;
} }
public bool PostObjectEvent(UUID itemID, string name, object[] args) public bool PostObjectEvent(UUID itemID, string name, object[] args)
@ -195,11 +239,7 @@ namespace OpenSim.Tests.Common
public Scene World { get { return m_scene; } } public Scene World { get { return m_scene; } }
public IScriptModule ScriptModule { get { throw new System.NotImplementedException(); } } public IScriptModule ScriptModule { get { return this; } }
public IConfig Config { get { throw new System.NotImplementedException (); } }
public IConfigSource ConfigSource { get { throw new System.NotImplementedException (); } }
public string ScriptEnginePath { get { throw new System.NotImplementedException (); }} public string ScriptEnginePath { get { throw new System.NotImplementedException (); }}
@ -210,5 +250,10 @@ namespace OpenSim.Tests.Common
public string[] ScriptReferencedAssemblies { get { throw new System.NotImplementedException (); } } public string[] ScriptReferencedAssemblies { get { throw new System.NotImplementedException (); } }
public ParameterInfo[] ScriptBaseClassParameters { get { throw new System.NotImplementedException (); } } public ParameterInfo[] ScriptBaseClassParameters { get { throw new System.NotImplementedException (); } }
public void ClearPostedEvents()
{
PostedEvents.Clear();
}
} }
} }

View File

@ -47,6 +47,8 @@ namespace OpenSim.Tests
[SetUp] [SetUp]
public void SetUp() public void SetUp()
{ {
base.SetUp();
m_basePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); m_basePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
string path = Path.Combine(m_basePath, m_testSubdirectory); string path = Path.Combine(m_basePath, m_testSubdirectory);
Directory.CreateDirectory(path); Directory.CreateDirectory(path);

View File

@ -335,12 +335,19 @@
[Map] [Map]
;# {GenerateMaptiles} {} {Generate map tiles?} {true false} true ;# {GenerateMaptiles} {} {Generate map tiles?} {true false} true
;; Map tile options. You can choose to generate normal maptiles or nominate an uploaded texture to ;; Map tile options.
;; be the map tile using the MaptileStaticUUID parameter in this section or for individual regions in ;; If true, then maptiles are generated using the MapImageModule below.
;; the regions config file(s). If you do not want to upload map tiles at all, then you will need ;; If false then the texture referenced by MaptileStaticUUID is used instead, which can also be overriden
;; to disable the MapImageServiceModule entirely. ;; in individual region config file(s). If you do not want to upload map tiles at all, then you will need
;; both to set this to false and comment out the [Modules] MapImageServiceModule setting in config-include/
; GenerateMaptiles = true ; GenerateMaptiles = true
;# {MapImageModule} [] {The map image module to use} {MapImageModule Warp3DImageModule} MapImageModule
;; The module to use in order to generate map images.
;; MapImageModule is the default. Warp3DImageModule is an alternative experimental module that can
;; generate better images.
;MapImageModule = "MapImageModule"
;# {MaptileRefresh} {GenerateMaptiles} {Maptile refresh period?} {} 0 ;# {MaptileRefresh} {GenerateMaptiles} {Maptile refresh period?} {} 0
;; If desired, a running region can update the map tiles periodically ;; If desired, a running region can update the map tiles periodically
;; to reflect building activity. This names no sense of you don't have ;; to reflect building activity. This names no sense of you don't have

View File

@ -2321,7 +2321,6 @@
<ReferencePath>../../../../bin/</ReferencePath> <ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Data"/> <Reference name="System.Data"/>
<Reference name="System.Net"/>
<Reference name="System.Web"/> <Reference name="System.Web"/>
<Reference name="System.Xml"/> <Reference name="System.Xml"/>
<Reference name="OpenMetaverseTypes" path="../../../../bin/"/> <Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
@ -3517,6 +3516,8 @@
<Reference name="System.Xml"/> <Reference name="System.Xml"/>
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Region.CoreModules"/> <Reference name="OpenSim.Region.CoreModules"/>
<Reference name="OpenSim.Region.Framework"/> <Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Region.OptionalModules"/> <Reference name="OpenSim.Region.OptionalModules"/>