aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs73
-rw-r--r--OpenSim/Region/Framework/Interfaces/IHttpRequests.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs153
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs15
4 files changed, 187 insertions, 57 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index a676971..c2e37c4 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -187,6 +187,45 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
187 case (int)HttpRequestConstants.HTTP_VERIFY_CERT: 187 case (int)HttpRequestConstants.HTTP_VERIFY_CERT:
188 htc.HttpVerifyCert = (int.Parse(parms[i + 1]) != 0); 188 htc.HttpVerifyCert = (int.Parse(parms[i + 1]) != 0);
189 break; 189 break;
190
191 case (int)HttpRequestConstants.HTTP_VERBOSE_THROTTLE:
192
193 // TODO implement me
194 break;
195
196 case (int)HttpRequestConstants.HTTP_CUSTOM_HEADER:
197 //Parameters are in pairs and custom header takes
198 //arguments in pairs so adjust for header marker.
199 ++i;
200
201 //Maximum of 8 headers are allowed based on the
202 //Second Life documentation for llHTTPRequest.
203 for (int count = 1; count <= 8; ++count)
204 {
205 //Not enough parameters remaining for a header?
206 if (parms.Length - i < 2)
207 break;
208
209 //Have we reached the end of the list of headers?
210 //End is marked by a string with a single digit.
211 //We already know we have at least one parameter
212 //so it is safe to do this check at top of loop.
213 if (Char.IsDigit(parms[i][0]))
214 break;
215
216 if (htc.HttpCustomHeaders == null)
217 htc.HttpCustomHeaders = new List<string>();
218
219 htc.HttpCustomHeaders.Add(parms[i]);
220 htc.HttpCustomHeaders.Add(parms[i+1]);
221
222 i += 2;
223 }
224 break;
225
226 case (int)HttpRequestConstants.HTTP_PRAGMA_NO_CACHE:
227 htc.HttpPragmaNoCache = (int.Parse(parms[i + 1]) != 0);
228 break;
190 } 229 }
191 } 230 }
192 } 231 }
@@ -328,9 +367,12 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
328 // public const int HTTP_METHOD = 0; 367 // public const int HTTP_METHOD = 0;
329 // public const int HTTP_MIMETYPE = 1; 368 // public const int HTTP_MIMETYPE = 1;
330 // public const int HTTP_VERIFY_CERT = 3; 369 // public const int HTTP_VERIFY_CERT = 3;
370 // public const int HTTP_VERBOSE_THROTTLE = 4;
371 // public const int HTTP_CUSTOM_HEADER = 5;
372 // public const int HTTP_PRAGMA_NO_CACHE = 6;
331 private bool _finished; 373 private bool _finished;
332 public bool Finished 374 public bool Finished
333 { 375 {
334 get { return _finished; } 376 get { return _finished; }
335 } 377 }
336 // public int HttpBodyMaxLen = 2048; // not implemented 378 // public int HttpBodyMaxLen = 2048; // not implemented
@@ -340,11 +382,14 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
340 public string HttpMIMEType = "text/plain;charset=utf-8"; 382 public string HttpMIMEType = "text/plain;charset=utf-8";
341 public int HttpTimeout; 383 public int HttpTimeout;
342 public bool HttpVerifyCert = true; 384 public bool HttpVerifyCert = true;
385 //public bool HttpVerboseThrottle = true; // not implemented
386 public List<string> HttpCustomHeaders = null;
387 public bool HttpPragmaNoCache = true;
343 private Thread httpThread; 388 private Thread httpThread;
344 389
345 // Request info 390 // Request info
346 private UUID _itemID; 391 private UUID _itemID;
347 public UUID ItemID 392 public UUID ItemID
348 { 393 {
349 get { return _itemID; } 394 get { return _itemID; }
350 set { _itemID = value; } 395 set { _itemID = value; }
@@ -360,7 +405,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
360 public string proxyexcepts; 405 public string proxyexcepts;
361 public string OutboundBody; 406 public string OutboundBody;
362 private UUID _reqID; 407 private UUID _reqID;
363 public UUID ReqID 408 public UUID ReqID
364 { 409 {
365 get { return _reqID; } 410 get { return _reqID; }
366 set { _reqID = value; } 411 set { _reqID = value; }
@@ -401,7 +446,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
401 Request.Method = HttpMethod; 446 Request.Method = HttpMethod;
402 Request.ContentType = HttpMIMEType; 447 Request.ContentType = HttpMIMEType;
403 448
404 if(!HttpVerifyCert) 449 if (!HttpVerifyCert)
405 { 450 {
406 // We could hijack Connection Group Name to identify 451 // We could hijack Connection Group Name to identify
407 // a desired security exception. But at the moment we'll use a dummy header instead. 452 // a desired security exception. But at the moment we'll use a dummy header instead.
@@ -412,14 +457,24 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
412// { 457// {
413// Request.ConnectionGroupName="Verify"; 458// Request.ConnectionGroupName="Verify";
414// } 459// }
415 if (proxyurl != null && proxyurl.Length > 0) 460 if (!HttpPragmaNoCache)
461 {
462 Request.Headers.Add("Pragma", "no-cache");
463 }
464 if (HttpCustomHeaders != null)
416 { 465 {
417 if (proxyexcepts != null && proxyexcepts.Length > 0) 466 for (int i = 0; i < HttpCustomHeaders.Count; i += 2)
467 Request.Headers.Add(HttpCustomHeaders[i],
468 HttpCustomHeaders[i+1]);
469 }
470 if (proxyurl != null && proxyurl.Length > 0)
471 {
472 if (proxyexcepts != null && proxyexcepts.Length > 0)
418 { 473 {
419 string[] elist = proxyexcepts.Split(';'); 474 string[] elist = proxyexcepts.Split(';');
420 Request.Proxy = new WebProxy(proxyurl, true, elist); 475 Request.Proxy = new WebProxy(proxyurl, true, elist);
421 } 476 }
422 else 477 else
423 { 478 {
424 Request.Proxy = new WebProxy(proxyurl, true); 479 Request.Proxy = new WebProxy(proxyurl, true);
425 } 480 }
@@ -432,7 +487,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
432 Request.Headers[entry.Key] = entry.Value; 487 Request.Headers[entry.Key] = entry.Value;
433 488
434 // Encode outbound data 489 // Encode outbound data
435 if (OutboundBody.Length > 0) 490 if (OutboundBody.Length > 0)
436 { 491 {
437 byte[] data = Util.UTF8.GetBytes(OutboundBody); 492 byte[] data = Util.UTF8.GetBytes(OutboundBody);
438 493
diff --git a/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs b/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs
index de0f2a3..eb6c5ac 100644
--- a/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs
+++ b/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs
@@ -36,6 +36,9 @@ namespace OpenSim.Region.Framework.Interfaces
36 HTTP_MIMETYPE = 1, 36 HTTP_MIMETYPE = 1,
37 HTTP_BODY_MAXLENGTH = 2, 37 HTTP_BODY_MAXLENGTH = 2,
38 HTTP_VERIFY_CERT = 3, 38 HTTP_VERIFY_CERT = 3,
39 HTTP_VERBOSE_THROTTLE = 4,
40 HTTP_CUSTOM_HEADER = 5,
41 HTTP_PRAGMA_NO_CACHE = 6
39 } 42 }
40 43
41 public interface IHttpRequestModule 44 public interface IHttpRequestModule
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 1ab107a..42413a3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -66,6 +66,7 @@ using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
66using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; 66using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
67using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; 67using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
68using System.Reflection; 68using System.Reflection;
69using System.Linq;
69 70
70namespace OpenSim.Region.ScriptEngine.Shared.Api 71namespace OpenSim.Region.ScriptEngine.Shared.Api
71{ 72{
@@ -110,6 +111,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
110 protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. 111 protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp.
111 protected ISoundModule m_SoundModule = null; 112 protected ISoundModule m_SoundModule = null;
112 113
114 //An array of HTTP/1.1 headers that are not allowed to be used
115 //as custom headers by llHTTPRequest.
116 private string[] HttpStandardHeaders =
117 {
118 "Accept", "Accept-Charset", "Accept-Encoding", "Accept-Language",
119 "Accept-Ranges", "Age", "Allow", "Authorization", "Cache-Control",
120 "Connection", "Content-Encoding", "Content-Language",
121 "Content-Length", "Content-Location", "Content-MD5",
122 "Content-Range", "Content-Type", "Date", "ETag", "Expect",
123 "Expires", "From", "Host", "If-Match", "If-Modified-Since",
124 "If-None-Match", "If-Range", "If-Unmodified-Since", "Last-Modified",
125 "Location", "Max-Forwards", "Pragma", "Proxy-Authenticate",
126 "Proxy-Authorization", "Range", "Referer", "Retry-After", "Server",
127 "TE", "Trailer", "Transfer-Encoding", "Upgrade", "User-Agent",
128 "Vary", "Via", "Warning", "WWW-Authenticate"
129 };
130
113 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) 131 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item)
114 { 132 {
115 m_ScriptEngine = ScriptEngine; 133 m_ScriptEngine = ScriptEngine;
@@ -1522,7 +1540,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1522 if (tex.FaceTextures[i] != null) 1540 if (tex.FaceTextures[i] != null)
1523 { 1541 {
1524 tex.FaceTextures[i].Shiny = sval; 1542 tex.FaceTextures[i].Shiny = sval;
1525 tex.FaceTextures[i].Bump = bump;; 1543 tex.FaceTextures[i].Bump = bump;
1526 } 1544 }
1527 tex.DefaultTexture.Shiny = sval; 1545 tex.DefaultTexture.Shiny = sval;
1528 tex.DefaultTexture.Bump = bump; 1546 tex.DefaultTexture.Bump = bump;
@@ -1631,7 +1649,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1631 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); 1649 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
1632 tex.DefaultTexture.RGBA = texcolor; 1650 tex.DefaultTexture.RGBA = texcolor;
1633 } 1651 }
1634 1652
1635 part.UpdateTextureEntry(tex.GetBytes()); 1653 part.UpdateTextureEntry(tex.GetBytes());
1636 return; 1654 return;
1637 } 1655 }
@@ -1752,7 +1770,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1752 rgb.x = texcolor.R; 1770 rgb.x = texcolor.R;
1753 rgb.y = texcolor.G; 1771 rgb.y = texcolor.G;
1754 rgb.z = texcolor.B; 1772 rgb.z = texcolor.B;
1755 1773
1756 return rgb; 1774 return rgb;
1757 } 1775 }
1758 else 1776 else
@@ -1784,12 +1802,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1784 { 1802 {
1785 UUID textureID = new UUID(); 1803 UUID textureID = new UUID();
1786 1804
1787 textureID = InventoryKey(texture, (int)AssetType.Texture); 1805 textureID = InventoryKey(texture, (int)AssetType.Texture);
1788 if (textureID == UUID.Zero) 1806 if (textureID == UUID.Zero)
1789 { 1807 {
1790 if (!UUID.TryParse(texture, out textureID)) 1808 if (!UUID.TryParse(texture, out textureID))
1791 return; 1809 return;
1792 } 1810 }
1793 1811
1794 Primitive.TextureEntry tex = part.Shape.Textures; 1812 Primitive.TextureEntry tex = part.Shape.Textures;
1795 1813
@@ -1986,7 +2004,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1986 // IF YOU GET REGION CROSSINGS WORKING WITH THIS FUNCTION, REPLACE THE WORKAROUND. 2004 // IF YOU GET REGION CROSSINGS WORKING WITH THIS FUNCTION, REPLACE THE WORKAROUND.
1987 // 2005 //
1988 // This workaround is to prevent silent failure of this function. 2006 // This workaround is to prevent silent failure of this function.
1989 // According to the specification on the SL Wiki, providing a position outside of the 2007 // According to the specification on the SL Wiki, providing a position outside of the
1990 if (pos.x < 0 || pos.x > Constants.RegionSize || pos.y < 0 || pos.y > Constants.RegionSize) 2008 if (pos.x < 0 || pos.x > Constants.RegionSize || pos.y < 0 || pos.y > Constants.RegionSize)
1991 { 2009 {
1992 return 0; 2010 return 0;
@@ -2195,7 +2213,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2195 { 2213 {
2196 return llGetRootRotation(); 2214 return llGetRootRotation();
2197 } 2215 }
2198 2216
2199 m_host.AddScriptLPS(1); 2217 m_host.AddScriptLPS(1);
2200 Quaternion q = m_host.GetWorldRotation(); 2218 Quaternion q = m_host.GetWorldRotation();
2201 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 2219 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
@@ -2882,7 +2900,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2882 // we need to convert from a vector describing 2900 // we need to convert from a vector describing
2883 // the angles of rotation in radians into rotation value 2901 // the angles of rotation in radians into rotation value
2884 LSL_Rotation rot = llEuler2Rot(angle); 2902 LSL_Rotation rot = llEuler2Rot(angle);
2885 2903
2886 // Per discussion with Melanie, for non-physical objects llLookAt appears to simply 2904 // Per discussion with Melanie, for non-physical objects llLookAt appears to simply
2887 // set the rotation of the object, copy that behavior 2905 // set the rotation of the object, copy that behavior
2888 PhysicsActor pa = m_host.PhysActor; 2906 PhysicsActor pa = m_host.PhysActor;
@@ -2958,7 +2976,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2958 2976
2959 if (!UUID.TryParse(id, out objectID)) 2977 if (!UUID.TryParse(id, out objectID))
2960 objectID = UUID.Zero; 2978 objectID = UUID.Zero;
2961 2979
2962 if (objectID == UUID.Zero && name == "") 2980 if (objectID == UUID.Zero && name == "")
2963 return; 2981 return;
2964 2982
@@ -3142,19 +3160,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3142 msg.ParentEstateID = 0; //ParentEstateID; 3160 msg.ParentEstateID = 0; //ParentEstateID;
3143 msg.Position = new Vector3(m_host.AbsolutePosition); 3161 msg.Position = new Vector3(m_host.AbsolutePosition);
3144 msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid; 3162 msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid;
3145 msg.binaryBucket 3163 msg.binaryBucket
3146 = Util.StringToBytes256( 3164 = Util.StringToBytes256(
3147 "{0}/{1}/{2}/{3}", 3165 "{0}/{1}/{2}/{3}",
3148 World.RegionInfo.RegionName, 3166 World.RegionInfo.RegionName,
3149 (int)Math.Floor(m_host.AbsolutePosition.X), 3167 (int)Math.Floor(m_host.AbsolutePosition.X),
3150 (int)Math.Floor(m_host.AbsolutePosition.Y), 3168 (int)Math.Floor(m_host.AbsolutePosition.Y),
3151 (int)Math.Floor(m_host.AbsolutePosition.Z)); 3169 (int)Math.Floor(m_host.AbsolutePosition.Z));
3152 3170
3153 if (m_TransferModule != null) 3171 if (m_TransferModule != null)
3154 { 3172 {
3155 m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); 3173 m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
3156 } 3174 }
3157 3175
3158 ScriptSleep(2000); 3176 ScriptSleep(2000);
3159 } 3177 }
3160 3178
@@ -3279,7 +3297,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3279 public void llRotLookAt(LSL_Rotation target, double strength, double damping) 3297 public void llRotLookAt(LSL_Rotation target, double strength, double damping)
3280 { 3298 {
3281 m_host.AddScriptLPS(1); 3299 m_host.AddScriptLPS(1);
3282 3300
3283 // Per discussion with Melanie, for non-physical objects llLookAt appears to simply 3301 // Per discussion with Melanie, for non-physical objects llLookAt appears to simply
3284 // set the rotation of the object, copy that behavior 3302 // set the rotation of the object, copy that behavior
3285 PhysicsActor pa = m_host.PhysActor; 3303 PhysicsActor pa = m_host.PhysActor;
@@ -4353,7 +4371,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4353 public void llCollisionSound(string impact_sound, double impact_volume) 4371 public void llCollisionSound(string impact_sound, double impact_volume)
4354 { 4372 {
4355 m_host.AddScriptLPS(1); 4373 m_host.AddScriptLPS(1);
4356 4374
4357 // TODO: Parameter check logic required. 4375 // TODO: Parameter check logic required.
4358 m_host.CollisionSound = KeyOrName(impact_sound, AssetType.Sound); 4376 m_host.CollisionSound = KeyOrName(impact_sound, AssetType.Sound);
4359 m_host.CollisionSoundVolume = (float)impact_volume; 4377 m_host.CollisionSoundVolume = (float)impact_volume;
@@ -5043,7 +5061,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5043 // SL spits out an empty string for types other than key & string 5061 // SL spits out an empty string for types other than key & string
5044 // At the time of patching, LSL_Key is currently LSL_String, 5062 // At the time of patching, LSL_Key is currently LSL_String,
5045 // so the OR check may be a little redundant, but it's being done 5063 // so the OR check may be a little redundant, but it's being done
5046 // for completion and should LSL_Key ever be implemented 5064 // for completion and should LSL_Key ever be implemented
5047 // as it's own struct 5065 // as it's own struct
5048 else if (!(src.Data[index] is LSL_String || 5066 else if (!(src.Data[index] is LSL_String ||
5049 src.Data[index] is LSL_Key)) 5067 src.Data[index] is LSL_Key))
@@ -5179,8 +5197,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5179 { 5197 {
5180 m_host.AddScriptLPS(1); 5198 m_host.AddScriptLPS(1);
5181 5199
5182 return string.Join(", ", 5200 return string.Join(", ",
5183 (new List<object>(src.Data)).ConvertAll<string>(o => 5201 (new List<object>(src.Data)).ConvertAll<string>(o =>
5184 { 5202 {
5185 return o.ToString(); 5203 return o.ToString();
5186 }).ToArray()); 5204 }).ToArray());
@@ -6223,7 +6241,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6223 SetParticleSystem(m_host, rules); 6241 SetParticleSystem(m_host, rules);
6224 } 6242 }
6225 6243
6226 private void SetParticleSystem(SceneObjectPart part, LSL_List rules) 6244 private void SetParticleSystem(SceneObjectPart part, LSL_List rules)
6227 { 6245 {
6228 if (rules.Length == 0) 6246 if (rules.Length == 0)
6229 { 6247 {
@@ -6460,7 +6478,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6460 m_host.OwnerID, m_host.Name, destID, 6478 m_host.OwnerID, m_host.Name, destID,
6461 (byte)InstantMessageDialog.TaskInventoryOffered, 6479 (byte)InstantMessageDialog.TaskInventoryOffered,
6462 false, string.Format("'{0}'", category), 6480 false, string.Format("'{0}'", category),
6463// We won't go so far as to add a SLURL, but this is the format used by LL as of 2012-10-06 6481// We won't go so far as to add a SLURL, but this is the format used by LL as of 2012-10-06
6464// false, string.Format("'{0}' ( http://slurl.com/secondlife/{1}/{2}/{3}/{4} )", category, World.Name, (int)pos.X, (int)pos.Y, (int)pos.Z), 6482// false, string.Format("'{0}' ( http://slurl.com/secondlife/{1}/{2}/{3}/{4} )", category, World.Name, (int)pos.X, (int)pos.Y, (int)pos.Z),
6465 folderID, false, pos, 6483 folderID, false, pos,
6466 bucket, false); 6484 bucket, false);
@@ -6575,12 +6593,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6575 public LSL_String llAvatarOnLinkSitTarget(int linknum) 6593 public LSL_String llAvatarOnLinkSitTarget(int linknum)
6576 { 6594 {
6577 m_host.AddScriptLPS(1); 6595 m_host.AddScriptLPS(1);
6578 if(linknum == ScriptBaseClass.LINK_SET || 6596 if(linknum == ScriptBaseClass.LINK_SET ||
6579 linknum == ScriptBaseClass.LINK_ALL_CHILDREN || 6597 linknum == ScriptBaseClass.LINK_ALL_CHILDREN ||
6580 linknum == ScriptBaseClass.LINK_ALL_OTHERS) return UUID.Zero.ToString(); 6598 linknum == ScriptBaseClass.LINK_ALL_OTHERS) return UUID.Zero.ToString();
6581 6599
6582 List<SceneObjectPart> parts = GetLinkParts(linknum); 6600 List<SceneObjectPart> parts = GetLinkParts(linknum);
6583 if (parts.Count == 0) return UUID.Zero.ToString(); 6601 if (parts.Count == 0) return UUID.Zero.ToString();
6584 return parts[0].SitTargetAvatar.ToString(); 6602 return parts[0].SitTargetAvatar.ToString();
6585 } 6603 }
6586 6604
@@ -6952,7 +6970,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6952 hollow = 0.70f; 6970 hollow = 0.70f;
6953 } 6971 }
6954 } 6972 }
6955 // Otherwise, hollow is limited to 95%. 6973 // Otherwise, hollow is limited to 95%.
6956 else 6974 else
6957 { 6975 {
6958 if (hollow > 0.95f) 6976 if (hollow > 0.95f)
@@ -8133,16 +8151,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8133 res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0)); 8151 res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0));
8134 8152
8135 // float revolutions 8153 // float revolutions
8136 res.Add(new LSL_Float(Math.Round(Shape.PathRevolutions * 0.015d, 2, MidpointRounding.AwayFromZero)) + 1.0d); 8154 res.Add(new LSL_Float(Math.Round(Shape.PathRevolutions * 0.015d, 2, MidpointRounding.AwayFromZero)) + 1.0d);
8137 // Slightly inaccurate, because an unsigned byte is being used to represent 8155 // Slightly inaccurate, because an unsigned byte is being used to represent
8138 // the entire range of floating-point values from 1.0 through 4.0 (which is how 8156 // the entire range of floating-point values from 1.0 through 4.0 (which is how
8139 // SL does it). 8157 // SL does it).
8140 // 8158 //
8141 // Using these formulas to store and retrieve PathRevolutions, it is not 8159 // Using these formulas to store and retrieve PathRevolutions, it is not
8142 // possible to use all values between 1.00 and 4.00. For instance, you can't 8160 // possible to use all values between 1.00 and 4.00. For instance, you can't
8143 // represent 1.10. You can represent 1.09 and 1.11, but not 1.10. So, if you 8161 // represent 1.10. You can represent 1.09 and 1.11, but not 1.10. So, if you
8144 // use llSetPrimitiveParams to set revolutions to 1.10 and then retreive them 8162 // use llSetPrimitiveParams to set revolutions to 1.10 and then retreive them
8145 // with llGetPrimitiveParams, you'll retrieve 1.09. You can also see a similar 8163 // with llGetPrimitiveParams, you'll retrieve 1.09. You can also see a similar
8146 // behavior in the viewer as you cannot set 1.10. The viewer jumps to 1.11. 8164 // behavior in the viewer as you cannot set 1.10. The viewer jumps to 1.11.
8147 // In SL, llSetPrimitveParams and llGetPrimitiveParams can set and get a value 8165 // In SL, llSetPrimitveParams and llGetPrimitiveParams can set and get a value
8148 // such as 1.10. So, SL must store and retreive the actual user input rather 8166 // such as 1.10. So, SL must store and retreive the actual user input rather
@@ -10264,9 +10282,60 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10264 IHttpRequestModule httpScriptMod = 10282 IHttpRequestModule httpScriptMod =
10265 m_ScriptEngine.World.RequestModuleInterface<IHttpRequestModule>(); 10283 m_ScriptEngine.World.RequestModuleInterface<IHttpRequestModule>();
10266 List<string> param = new List<string>(); 10284 List<string> param = new List<string>();
10267 foreach (object o in parameters.Data) 10285 bool ok;
10286 Int32 flag;
10287
10288 for (int i = 0; i < parameters.Data.Length; i += 2)
10268 { 10289 {
10269 param.Add(o.ToString()); 10290 ok = Int32.TryParse(parameters.Data[i].ToString(), out flag);
10291 if (!ok || flag < 0 ||
10292 flag > (int)HttpRequestConstants.HTTP_PRAGMA_NO_CACHE)
10293 {
10294 throw new ScriptException("Parameter " + i.ToString() + " is an invalid flag");
10295 }
10296
10297 param.Add(parameters.Data[i].ToString()); //Add parameter flag
10298
10299 if (flag != (int)HttpRequestConstants.HTTP_CUSTOM_HEADER)
10300 {
10301 param.Add(parameters.Data[i+1].ToString()); //Add parameter value
10302 }
10303 else
10304 {
10305 //Parameters are in pairs and custom header takes
10306 //arguments in pairs so adjust for header marker.
10307 ++i;
10308
10309 //Maximum of 8 headers are allowed based on the
10310 //Second Life documentation for llHTTPRequest.
10311 for (int count = 1; count <= 8; ++count)
10312 {
10313 //Enough parameters remaining for (another) header?
10314 if (parameters.Data.Length - i < 2)
10315 {
10316 //There must be at least one name/value pair for custom header
10317 if (count == 1)
10318 throw new ScriptException("Missing name/value for custom header at parameter " + i.ToString());
10319 break;
10320 }
10321
10322 if (HttpStandardHeaders.Contains(parameters.Data[i].ToString(), StringComparer.OrdinalIgnoreCase))
10323 throw new ScriptException("Name is invalid as a custom header at parameter " + i.ToString());
10324
10325 param.Add(parameters.Data[i].ToString());
10326 param.Add(parameters.Data[i+1].ToString());
10327
10328 //Have we reached the end of the list of headers?
10329 //End is marked by a string with a single digit.
10330 if (i+2 >= parameters.Data.Length ||
10331 Char.IsDigit(parameters.Data[i].ToString()[0]))
10332 {
10333 break;
10334 }
10335
10336 i += 2;
10337 }
10338 }
10270 } 10339 }
10271 10340
10272 Vector3 position = m_host.AbsolutePosition; 10341 Vector3 position = m_host.AbsolutePosition;
@@ -10376,12 +10445,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10376 public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide) 10445 public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide)
10377 { 10446 {
10378 m_host.AddScriptLPS(1); 10447 m_host.AddScriptLPS(1);
10379 10448
10380 ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y); 10449 ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y);
10381 10450
10382 if (lo == null) 10451 if (lo == null)
10383 return 0; 10452 return 0;
10384 10453
10385 IPrimCounts pc = lo.PrimCounts; 10454 IPrimCounts pc = lo.PrimCounts;
10386 10455
10387 if (sim_wide != ScriptBaseClass.FALSE) 10456 if (sim_wide != ScriptBaseClass.FALSE)
@@ -10411,7 +10480,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10411 else if (category == ScriptBaseClass.PARCEL_COUNT_TEMP) 10480 else if (category == ScriptBaseClass.PARCEL_COUNT_TEMP)
10412 return 0; // counts not implemented yet 10481 return 0; // counts not implemented yet
10413 } 10482 }
10414 10483
10415 return 0; 10484 return 0;
10416 } 10485 }
10417 10486
@@ -10754,7 +10823,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10754 return ret; 10823 return ret;
10755 } 10824 }
10756 } 10825 }
10757 10826
10758 return new LSL_List(); 10827 return new LSL_List();
10759 } 10828 }
10760 10829
@@ -11381,7 +11450,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11381 else 11450 else
11382 { 11451 {
11383 ScenePresence sp = World.GetScenePresence(result.ConsumerID); 11452 ScenePresence sp = World.GetScenePresence(result.ConsumerID);
11384 /// It it a boy? a girl? 11453 /// It it a boy? a girl?
11385 if (sp != null) 11454 if (sp != null)
11386 itemID = sp.UUID; 11455 itemID = sp.UUID;
11387 } 11456 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 9bf1a64..86ab03a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -355,6 +355,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
355 public const int HTTP_MIMETYPE = 1; 355 public const int HTTP_MIMETYPE = 1;
356 public const int HTTP_BODY_MAXLENGTH = 2; 356 public const int HTTP_BODY_MAXLENGTH = 2;
357 public const int HTTP_VERIFY_CERT = 3; 357 public const int HTTP_VERIFY_CERT = 3;
358 public const int HTTP_VERBOSE_THROTTLE = 4;
359 public const int HTTP_CUSTOM_HEADER = 5;
360 public const int HTTP_PRAGMA_NO_CACHE = 6;
358 361
359 public const int PRIM_MATERIAL = 2; 362 public const int PRIM_MATERIAL = 2;
360 public const int PRIM_PHYSICS = 3; 363 public const int PRIM_PHYSICS = 3;
@@ -635,7 +638,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
635 public const int TOUCH_INVALID_FACE = -1; 638 public const int TOUCH_INVALID_FACE = -1;
636 public static readonly vector TOUCH_INVALID_TEXCOORD = new vector(-1.0, -1.0, 0.0); 639 public static readonly vector TOUCH_INVALID_TEXCOORD = new vector(-1.0, -1.0, 0.0);
637 public static readonly vector TOUCH_INVALID_VECTOR = ZERO_VECTOR; 640 public static readonly vector TOUCH_INVALID_VECTOR = ZERO_VECTOR;
638 641
639 // constants for llGetPrimMediaParams/llSetPrimMediaParams 642 // constants for llGetPrimMediaParams/llSetPrimMediaParams
640 public const int PRIM_MEDIA_ALT_IMAGE_ENABLE = 0; 643 public const int PRIM_MEDIA_ALT_IMAGE_ENABLE = 0;
641 public const int PRIM_MEDIA_CONTROLS = 1; 644 public const int PRIM_MEDIA_CONTROLS = 1;
@@ -652,15 +655,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
652 public const int PRIM_MEDIA_WHITELIST = 12; 655 public const int PRIM_MEDIA_WHITELIST = 12;
653 public const int PRIM_MEDIA_PERMS_INTERACT = 13; 656 public const int PRIM_MEDIA_PERMS_INTERACT = 13;
654 public const int PRIM_MEDIA_PERMS_CONTROL = 14; 657 public const int PRIM_MEDIA_PERMS_CONTROL = 14;
655 658
656 public const int PRIM_MEDIA_CONTROLS_STANDARD = 0; 659 public const int PRIM_MEDIA_CONTROLS_STANDARD = 0;
657 public const int PRIM_MEDIA_CONTROLS_MINI = 1; 660 public const int PRIM_MEDIA_CONTROLS_MINI = 1;
658 661
659 public const int PRIM_MEDIA_PERM_NONE = 0; 662 public const int PRIM_MEDIA_PERM_NONE = 0;
660 public const int PRIM_MEDIA_PERM_OWNER = 1; 663 public const int PRIM_MEDIA_PERM_OWNER = 1;
661 public const int PRIM_MEDIA_PERM_GROUP = 2; 664 public const int PRIM_MEDIA_PERM_GROUP = 2;
662 public const int PRIM_MEDIA_PERM_ANYONE = 4; 665 public const int PRIM_MEDIA_PERM_ANYONE = 4;
663 666
664 // extra constants for llSetPrimMediaParams 667 // extra constants for llSetPrimMediaParams
665 public static readonly LSLInteger LSL_STATUS_OK = new LSLInteger(0); 668 public static readonly LSLInteger LSL_STATUS_OK = new LSLInteger(0);
666 public static readonly LSLInteger LSL_STATUS_MALFORMED_PARAMS = new LSLInteger(1000); 669 public static readonly LSLInteger LSL_STATUS_MALFORMED_PARAMS = new LSLInteger(1000);
@@ -677,7 +680,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
677 public const string TEXTURE_PLYWOOD = "89556747-24cb-43ed-920b-47caed15465f"; 680 public const string TEXTURE_PLYWOOD = "89556747-24cb-43ed-920b-47caed15465f";
678 public const string TEXTURE_TRANSPARENT = "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"; 681 public const string TEXTURE_TRANSPARENT = "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903";
679 public const string TEXTURE_MEDIA = "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361"; 682 public const string TEXTURE_MEDIA = "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361";
680 683
681 // Constants for osGetRegionStats 684 // Constants for osGetRegionStats
682 public const int STATS_TIME_DILATION = 0; 685 public const int STATS_TIME_DILATION = 0;
683 public const int STATS_SIM_FPS = 1; 686 public const int STATS_SIM_FPS = 1;
@@ -730,7 +733,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
730 public static readonly LSLInteger RC_GET_ROOT_KEY = 2; 733 public static readonly LSLInteger RC_GET_ROOT_KEY = 2;
731 public static readonly LSLInteger RC_GET_LINK_NUM = 4; 734 public static readonly LSLInteger RC_GET_LINK_NUM = 4;
732 735
733 public static readonly LSLInteger RCERR_UNKNOWN = -1; 736 public static readonly LSLInteger RCERR_UNKNOWN = -1;
734 public static readonly LSLInteger RCERR_SIM_PERF_LOW = -2; 737 public static readonly LSLInteger RCERR_SIM_PERF_LOW = -2;
735 public static readonly LSLInteger RCERR_CAST_TIME_EXCEEDED = 3; 738 public static readonly LSLInteger RCERR_CAST_TIME_EXCEEDED = 3;
736 739