From 23b247c519460a64ba3c089f15d548cbbcbd06db Mon Sep 17 00:00:00 2001 From: idb Date: Sat, 7 Mar 2009 12:58:00 +0000 Subject: Added the ability to set User-Agent in llHTTPRequest. No new default value has been set since having no User-Agent seems to work well but the facility is now available to set this if required. Using something based on the pattern of SLs User-Agent may well cause problems, not all web servers respond well to it. See the notes in the SL Wiki http://wiki.secondlife.com/wiki/LlHTTPRequest Fixes Mantis #3143 --- .../Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | 5 ++++- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 7142103..bdaecc5 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -358,7 +358,10 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest } foreach (KeyValuePair entry in ResponseHeaders) - Request.Headers[entry.Key] = entry.Value; + if (entry.Key.ToLower().Equals("user-agent")) + Request.UserAgent = entry.Value; + else + Request.Headers[entry.Key] = entry.Value; // Encode outbound data if (OutboundBody.Length > 0) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0908cd6..6bb0fe9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8726,6 +8726,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api httpHeaders["X-SecondLife-Local-Rotation"] = string.Format("({0:0.000000}, {1:0.000000}, {2:0.000000}, {3:0.000000})", rotation.X, rotation.Y, rotation.Z, rotation.W); httpHeaders["X-SecondLife-Owner-Name"] = scenePresence == null ? string.Empty : scenePresence.ControllingClient.Name; httpHeaders["X-SecondLife-Owner-Key"] = m_host.ObjectOwner.ToString(); + string userAgent = config.Configs["Network"].GetString("user_agent", null); + if (userAgent != null) + httpHeaders["User-Agent"] = userAgent; UUID reqID = httpScriptMod. StartHttpRequest(m_localID, m_itemID, url, param, httpHeaders, body); -- cgit v1.1