cosmetics

master
UbitUmarov 2020-04-09 13:41:41 +01:00
parent 523d6dd2da
commit c99014991b
13 changed files with 41 additions and 48 deletions

View File

@ -125,7 +125,8 @@ namespace OpenSim.Framework.Capabilities
None = 0,
SentSeeds = 1,
ObjectAnim = 0x10
ObjectAnim = 0x10,
AdvEnv = 0x20
}
public CapsFlags Flags { get; set;}

View File

@ -32,6 +32,7 @@ using System.Drawing;
using System.Drawing.Imaging;
using System.Reflection;
using System.IO;
using System.Net;
using System.Web;
using log4net;
using Nini.Config;
@ -136,7 +137,7 @@ namespace OpenSim.Capabilities.Handlers
{
string textureUrl = m_RedirectURL + "?texture_id=" + textureID.ToString();
m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl);
httpResponse.StatusCode = (int)OSHttpStatusCode.RedirectMovedPermanently;
httpResponse.StatusCode = (int)HttpStatusCode.Moved;
httpResponse.AddHeader("Location:", textureUrl);
return true;
}

View File

@ -1703,7 +1703,7 @@ namespace OpenSim.Framework.Servers.HttpServer
response.AddHeader("Access-Control-Allow-Origin", "*");
response.AddHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT, OPTIONS");
response.AddHeader("Access-Control-Allow-Headers", "Content-Type");
response.StatusCode = (int)OSHttpStatusCode.SuccessOk;
response.StatusCode = (int)HttpStatusCode.OK;
return null;
default:
@ -1948,7 +1948,7 @@ namespace OpenSim.Framework.Servers.HttpServer
response.StatusCode = responsecode;
if (responsecode == (int)OSHttpStatusCode.RedirectMovedPermanently)
if (responsecode == (int)HttpStatusCode.Moved)
{
response.AddHeader("Location:", (string)responsedata["str_redirect_location"]);
response.StatusCode = responsecode;
@ -2010,7 +2010,7 @@ namespace OpenSim.Framework.Servers.HttpServer
public byte[] SendHTML500(OSHttpResponse response)
{
// I know this statuscode is dumb, but the client doesn't respond to 404s and 500s
response.StatusCode = (int)OSHttpStatusCode.SuccessOk;
response.StatusCode = (int)HttpStatusCode.OK;
response.AddHeader("Content-type", "text/html");
string responseString = GetHTTP500();

View File

@ -28,6 +28,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Net;
using System.Reflection;
using System.Text;
using OSHttpServer;
@ -132,7 +133,7 @@ namespace OpenSim.Framework.Servers.HttpServer
response.StatusCode = responsecode;
if (responsecode == (int)OSHttpStatusCode.RedirectMovedPermanently)
if (responsecode == (int)HttpStatusCode.Moved)
{
response.AddHeader("Location:", (string)responsedata["str_redirect_location"]);
response.KeepAlive = false;

View File

@ -242,13 +242,13 @@ namespace OpenSim.Framework.Servers.HttpServer
if (string.IsNullOrEmpty(_request.Headers["upgrade"]))
{
FailUpgrade(OSHttpStatusCode.ClientErrorBadRequest, "no upgrade request submitted");
FailUpgrade(HttpStatusCode.BadRequest, "no upgrade request submitted");
}
string connectionheader = _request.Headers["upgrade"];
if (connectionheader.ToLower() != "websocket")
{
FailUpgrade(OSHttpStatusCode.ClientErrorBadRequest, "no connection upgrade request submitted");
FailUpgrade(HttpStatusCode.BadRequest, "no connection upgrade request submitted");
}
// If the object consumer provided a method to validate the origin, we should call it and give the client a success or fail.
@ -266,7 +266,7 @@ namespace OpenSim.Framework.Servers.HttpServer
}
else
{
FailUpgrade(OSHttpStatusCode.ClientErrorForbidden, "Origin Validation Failed");
FailUpgrade(HttpStatusCode.Forbidden, "Origin Validation Failed");
}
}
else
@ -353,7 +353,7 @@ namespace OpenSim.Framework.Servers.HttpServer
/// </summary>
/// <param name="pCode">HTTP Status reflecting the reason why</param>
/// <param name="pMessage">Textual reason for the upgrade fail</param>
private void FailUpgrade(OSHttpStatusCode pCode, string pMessage )
private void FailUpgrade(HttpStatusCode pCode, string pMessage )
{
string handshakeResponse = string.Format(HandshakeDeclineText, (int)pCode, pMessage.Replace("\n", string.Empty).Replace("\r", string.Empty));
byte[] bhandshakeResponse = Encoding.UTF8.GetBytes(handshakeResponse);

View File

@ -2667,6 +2667,8 @@ namespace OpenSim.Framework
public static bool TryParseHttpRange(string header, out int start, out int end)
{
start = end = 0;
if(string.IsNullOrWhiteSpace(header))
return false;
if (header.StartsWith("bytes="))
{

View File

@ -115,7 +115,6 @@ namespace OpenSim
"[OPENSIM MAIN]: Environment variable MONO_THREADS_PER_CPU is {0}", monoThreadsPerCpu ?? "unset");
}
// Verify the Threadpool allocates or uses enough worker and IO completion threads
// .NET 2.0, workerthreads default to 50 * numcores
// .NET 3.0, workerthreads defaults to 250 * numcores

View File

@ -750,8 +750,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
if (pprocessor.Async)
{
object obj = new AsyncPacketProcess(pprocessor.method, packet);
m_asyncPacketProcess.QueueJob(packet.Type.ToString(), () => ProcessSpecificPacketAsync(obj));
m_asyncPacketProcess.QueueJob(packet.Type.ToString(), () =>
{
try
{
pprocessor.method(packet);
}
catch (Exception e)
{
// Make sure that we see any exception caused by the asynchronous operation.
m_log.Error(string.Format(
"[LLCLIENTVIEW]: Caught exception while processing {0} for {1} ", packet, Name),e);
}
});
}
else
{
@ -762,24 +773,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return false;
}
public void ProcessSpecificPacketAsync(object state)
{
AsyncPacketProcess packetObject = (AsyncPacketProcess)state;
try
{
packetObject.Method(packetObject.Pack);
}
catch (Exception e)
{
// Make sure that we see any exception caused by the asynchronous operation.
m_log.Error(
string.Format(
"[LLCLIENTVIEW]: Caught exception while processing {0} for {1} ", packetObject.Pack, Name),
e);
}
}
#endregion Packet Handling
# region Setup

View File

@ -75,14 +75,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
return;
lock (m_scenes)
{
if (!m_scenes.Contains(scene))
{
m_scenes.Add(scene);
scene.EventManager.OnClientConnect += OnClientConnect;
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
}
}
m_scenes.Add(scene);
}
public virtual void RegionLoaded(Scene scene)
@ -92,8 +85,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
if (m_TransferModule == null)
{
m_TransferModule =
scene.RequestModuleInterface<IMessageTransferModule>();
m_TransferModule = scene.RequestModuleInterface<IMessageTransferModule>();
if (m_TransferModule == null)
{
@ -105,6 +97,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
m_enabled = false;
}
}
scene.EventManager.OnClientConnect += OnClientConnect;
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
}
public virtual void RemoveRegion(Scene scene)

View File

@ -708,7 +708,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
}
else
{
Status = (int)OSHttpStatusCode.ClientErrorJoker;
Status = 499; //ClientErrorJoker;
ResponseBody = e.Message;
}
}
@ -733,7 +733,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
{
if (Redirects >= MaxRedirects)
{
Status = (int)OSHttpStatusCode.ClientErrorJoker;
Status = 499;//.ClientErrorJoker;
ResponseBody = "Number of redirects exceeded max redirects";
WorkItem = null;
RequestModule.GotCompletedRequest(this);
@ -744,14 +744,14 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
if (location == null)
{
Status = (int)OSHttpStatusCode.ClientErrorJoker;
Status = 499;//ClientErrorJoker;
ResponseBody = "HTTP redirect code but no location header";
WorkItem = null;
RequestModule.GotCompletedRequest(this);
}
else if (!RequestModule.CheckAllowed(new Uri(location)))
{
Status = (int)OSHttpStatusCode.ClientErrorJoker;
Status = 499;//ClientErrorJoker;
ResponseBody = "URL from HTTP redirect blocked: " + location;
WorkItem = null;
RequestModule.GotCompletedRequest(this);

View File

@ -29,6 +29,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Net;
using System.Xml;
using Nini.Config;
@ -115,7 +116,7 @@ namespace OpenSim.Server.Handlers.MapImage
if (!request.ContainsKey("X") || !request.ContainsKey("Y") || !request.ContainsKey("DATA"))
{
httpResponse.StatusCode = (int)OSHttpStatusCode.ClientErrorBadRequest;
httpResponse.StatusCode = (int)HttpStatusCode.BadRequest;
return FailureResult("Bad request.");
}
int x = 0, y = 0;

View File

@ -29,6 +29,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Net;
using System.Xml;
using Nini.Config;
@ -113,7 +114,7 @@ namespace OpenSim.Server.Handlers.MapImage
if (!request.ContainsKey("X") || !request.ContainsKey("Y"))
{
httpResponse.StatusCode = (int)OSHttpStatusCode.ClientErrorBadRequest;
httpResponse.StatusCode = (int)HttpStatusCode.BadRequest;
return FailureResult("Bad request.");
}
int x = 0, y = 0;

View File

@ -117,7 +117,7 @@ namespace OpenSim.Services.GridService
for(int i = 0; i < alias.Length; ++i)
{
if(!string.IsNullOrWhiteSpace(alias[i]))
m_ThisGateKeeperAlias.Add(alias[i].ToLower());
m_ThisGateKeeperAlias.Add(alias[i].Trim().ToLower());
}
}