diff options
author | idb | 2009-03-07 12:58:00 +0000 |
---|---|---|
committer | idb | 2009-03-07 12:58:00 +0000 |
commit | 23b247c519460a64ba3c089f15d548cbbcbd06db (patch) | |
tree | 0efafa153ee26e9877c05e16d3fe08833128d0b1 | |
parent | Correct casts so that the target id in the at_target event matches the origin... (diff) | |
download | opensim-SC_OLD-23b247c519460a64ba3c089f15d548cbbcbd06db.zip opensim-SC_OLD-23b247c519460a64ba3c089f15d548cbbcbd06db.tar.gz opensim-SC_OLD-23b247c519460a64ba3c089f15d548cbbcbd06db.tar.bz2 opensim-SC_OLD-23b247c519460a64ba3c089f15d548cbbcbd06db.tar.xz |
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
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 | ||||
-rw-r--r-- | bin/OpenSim.ini.example | 8 |
3 files changed, 14 insertions, 2 deletions
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 | |||
358 | } | 358 | } |
359 | 359 | ||
360 | foreach (KeyValuePair<string, string> entry in ResponseHeaders) | 360 | foreach (KeyValuePair<string, string> entry in ResponseHeaders) |
361 | Request.Headers[entry.Key] = entry.Value; | 361 | if (entry.Key.ToLower().Equals("user-agent")) |
362 | Request.UserAgent = entry.Value; | ||
363 | else | ||
364 | Request.Headers[entry.Key] = entry.Value; | ||
362 | 365 | ||
363 | // Encode outbound data | 366 | // Encode outbound data |
364 | if (OutboundBody.Length > 0) | 367 | 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 | |||
8726 | 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); | 8726 | 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); |
8727 | httpHeaders["X-SecondLife-Owner-Name"] = scenePresence == null ? string.Empty : scenePresence.ControllingClient.Name; | 8727 | httpHeaders["X-SecondLife-Owner-Name"] = scenePresence == null ? string.Empty : scenePresence.ControllingClient.Name; |
8728 | httpHeaders["X-SecondLife-Owner-Key"] = m_host.ObjectOwner.ToString(); | 8728 | httpHeaders["X-SecondLife-Owner-Key"] = m_host.ObjectOwner.ToString(); |
8729 | string userAgent = config.Configs["Network"].GetString("user_agent", null); | ||
8730 | if (userAgent != null) | ||
8731 | httpHeaders["User-Agent"] = userAgent; | ||
8729 | 8732 | ||
8730 | UUID reqID = httpScriptMod. | 8733 | UUID reqID = httpScriptMod. |
8731 | StartHttpRequest(m_localID, m_itemID, url, param, httpHeaders, body); | 8734 | StartHttpRequest(m_localID, m_itemID, url, param, httpHeaders, body); |
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 7f1c55b..b62cd77 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example | |||
@@ -327,6 +327,12 @@ InterregionComms = "RESTComms" | |||
327 | ; The old default is "OpenSim", set here fro compatibility | 327 | ; The old default is "OpenSim", set here fro compatibility |
328 | shard = "OpenSim" | 328 | shard = "OpenSim" |
329 | 329 | ||
330 | ; What is reported as the "User-Agent" when using llHTTPRequest | ||
331 | ; Defaults to not sent if not set here. See the notes section in the wiki at | ||
332 | ; http://wiki.secondlife.com/wiki/LlHTTPRequest for comments on adding | ||
333 | ; " (Mozilla Compatible)" to the text where there are problems with a web server | ||
334 | ;user_agent = "OpenSim LSL (Mozilla Compatible)" | ||
335 | |||
330 | [ClientStack.LindenUDP] | 336 | [ClientStack.LindenUDP] |
331 | ; This is the multiplier applied to all client throttles for outgoing UDP network data | 337 | ; This is the multiplier applied to all client throttles for outgoing UDP network data |
332 | ; If it is set to 1, then we obey the throttle settings as given to us by the client. If it is set to 3, for example, then we | 338 | ; If it is set to 1, then we obey the throttle settings as given to us by the client. If it is set to 3, for example, then we |
@@ -1063,4 +1069,4 @@ InterregionComms = "RESTComms" | |||
1063 | channel_notify = -800 | 1069 | channel_notify = -800 |
1064 | 1070 | ||
1065 | [MRM] | 1071 | [MRM] |
1066 | Enabled = false ; Enables the Mini Region Modules Script Engine. WARNING: SECURITY RISK. \ No newline at end of file | 1072 | Enabled = false ; Enables the Mini Region Modules Script Engine. WARNING: SECURITY RISK. |