From a1217410e5cb22a5764f191b6abfa015ec9614d1 Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Fri, 19 Sep 2008 00:13:16 +0000
Subject: * Switches content type from application/xml+llsd to
 application/llsd+xml on outgoing requests. * Monitors / for getting the seed
 cap for rez_avatar/request on application/llsd+xml && application/xml+llsd &&
 !application/xml * Experimental, this might break LibOMV temporarily.

---
 OpenSim/Framework/Servers/BaseHttpServer.cs        |  2 +-
 .../Modules/InterGrid/OpenGridProtocolModule.cs    | 39 ++++++++++++++++++++--
 2 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index 264ffae..7bf8a3c 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -650,7 +650,7 @@ namespace OpenSim.Framework.Servers
                 llsdResponse = GenerateNoLLSDHandlerResponse();
             }
 
-            response.ContentType = "application/xml+llsd";
+            response.ContentType = "application/llsd+xml";
 
             byte[] buffer = LLSDParser.SerializeXmlBytes(llsdResponse);
 
diff --git a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs
index 687fa82..1fd559e 100644
--- a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs
+++ b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs
@@ -127,6 +127,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
                         if (m_scene.Count == 0)
                         {
                             scene.AddLLSDHandler("/agent/", ProcessAgentDomainMessage);
+                            scene.AddLLSDHandler("/", ProcessAgentDomainMessage);
                             try
                             {
                                 ServicePointManager.ServerCertificateValidationCallback += customXertificateValidation;
@@ -200,9 +201,15 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
             // /agent/*
 
             string[] pathSegments = path.Split('/');
-            if (pathSegments.Length < 1)
+            if (pathSegments.Length <= 1)
             {
                 return GenerateNoHandlerMessage();
+                
+            }
+
+            if (pathSegments[0].Length == 0 && pathSegments[1].Length == 0)
+            {
+                return GenerateRezAvatarRequestMessage("");
             }
 
             m_log.InfoFormat("[OGP]: path {0}, segments {1} segment[1] {2} Last segment {3}",
@@ -239,6 +246,34 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
             //return null;
         }
 
+        private LLSD GenerateRezAvatarRequestMessage(string regionname)
+        {
+            Scene region = GetRootScene();
+            RegionInfo reg = region.RegionInfo;
+
+            LLSDMap responseMap = new LLSDMap();
+            string rezHttpProtocol = "http://";
+            string regionCapsHttpProtocol = "http://";
+            string httpaddr = reg.ExternalHostName;
+            string urlport = reg.HttpPort.ToString();
+            string requestpath = "/agent/" + UUID.Zero + "/rez_avatar/request";
+
+            if (httpSSL)
+            {
+                rezHttpProtocol = "https://";
+                regionCapsHttpProtocol = "https://";
+                urlport = httpsslport.ToString();
+
+                if (httpsCN.Length > 0)
+                    httpaddr = httpsCN;
+            }
+
+            responseMap["connect"] = LLSD.FromBoolean(true);
+            responseMap["rez_avatar/request"] = LLSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + requestpath);
+            
+            return responseMap;
+        }
+
         // Using OpenSim.Framework.Communications.Capabilities.Caps here one time..   
         // so the long name is probably better then a using statement
         public void OnRegisterCaps(UUID agentID, OpenSim.Framework.Communications.Capabilities.Caps caps)
@@ -393,7 +428,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
 
             //string raCap = string.Empty;
 
-            UUID AvatarRezCapUUID = UUID.Random();
+            UUID AvatarRezCapUUID = LocalAgentID;
             string rezAvatarPath = "/agent/" + AvatarRezCapUUID + "/rez_avatar/rez";
             string derezAvatarPath = "/agent/" + AvatarRezCapUUID + "/rez_avatar/derez";
             // Get a reference to the user's cap so we can pull out the Caps Object Path
-- 
cgit v1.1