HG: Added HEAD method to Helo service. This is the preferred method, but its wide use will have to wait a few releases. So the sims are still calling GET for now.

iar_mods
Diva Canto 2011-12-04 10:10:09 -08:00
parent 080dfcc9c9
commit a2d98c7293
2 changed files with 35 additions and 1 deletions

View File

@ -45,9 +45,11 @@ namespace OpenSim.Server.Handlers.Hypergrid
base(config, server, configName)
{
server.AddStreamHandler(new HeloServerGetHandler("opensim-robust"));
server.AddStreamHandler(new HeloServerHeadHandler("opensim-robust"));
}
}
[Obsolete]
public class HeloServerGetHandler : BaseStreamHandler
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -68,7 +70,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
private byte[] OKResponse(OSHttpResponse httpResponse)
{
m_log.Debug("[HELO]: hi, I was called");
m_log.Debug("[HELO]: hi, GET was called");
httpResponse.AddHeader("X-Handlers-Provided", m_HandlersType);
httpResponse.StatusCode = (int)HttpStatusCode.OK;
httpResponse.StatusDescription = "OK";
@ -76,4 +78,34 @@ namespace OpenSim.Server.Handlers.Hypergrid
}
}
public class HeloServerHeadHandler : BaseStreamHandler
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string m_HandlersType;
public HeloServerHeadHandler(string handlersType) :
base("HEAD", "/helo")
{
m_HandlersType = handlersType;
}
public override byte[] Handle(string path, Stream requestData,
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{
return OKResponse(httpResponse);
}
private byte[] OKResponse(OSHttpResponse httpResponse)
{
m_log.Debug("[HELO]: hi, HEAD was called");
httpResponse.AddHeader("X-Handlers-Provided", m_HandlersType);
httpResponse.StatusCode = (int)HttpStatusCode.OK;
httpResponse.StatusDescription = "OK";
return new byte[0];
}
}
}

View File

@ -54,6 +54,8 @@ namespace OpenSim.Services.Connectors
public virtual string Helo()
{
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI + "/helo");
// Eventually we need to switch to HEAD
/* req.Method = "HEAD"; */
try
{