Added missing functionality (mainly custom headers) to llHTTPRequest.

user_profiles
Kevin Cozens 2013-03-27 17:26:17 -04:00 committed by Justin Clark-Casey (justincc)
parent 023faa227e
commit cbc9ae898c
5 changed files with 196 additions and 65 deletions

View File

@ -187,6 +187,45 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
case (int)HttpRequestConstants.HTTP_VERIFY_CERT: case (int)HttpRequestConstants.HTTP_VERIFY_CERT:
htc.HttpVerifyCert = (int.Parse(parms[i + 1]) != 0); htc.HttpVerifyCert = (int.Parse(parms[i + 1]) != 0);
break; break;
case (int)HttpRequestConstants.HTTP_VERBOSE_THROTTLE:
// TODO implement me
break;
case (int)HttpRequestConstants.HTTP_CUSTOM_HEADER:
//Parameters are in pairs and custom header takes
//arguments in pairs so adjust for header marker.
++i;
//Maximum of 8 headers are allowed based on the
//Second Life documentation for llHTTPRequest.
for (int count = 1; count <= 8; ++count)
{
//Not enough parameters remaining for a header?
if (parms.Length - i < 2)
break;
//Have we reached the end of the list of headers?
//End is marked by a string with a single digit.
//We already know we have at least one parameter
//so it is safe to do this check at top of loop.
if (Char.IsDigit(parms[i][0]))
break;
if (htc.HttpCustomHeaders == null)
htc.HttpCustomHeaders = new List<string>();
htc.HttpCustomHeaders.Add(parms[i]);
htc.HttpCustomHeaders.Add(parms[i+1]);
i += 2;
}
break;
case (int)HttpRequestConstants.HTTP_PRAGMA_NO_CACHE:
htc.HttpPragmaNoCache = (int.Parse(parms[i + 1]) != 0);
break;
} }
} }
} }
@ -328,9 +367,12 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
// public const int HTTP_METHOD = 0; // public const int HTTP_METHOD = 0;
// public const int HTTP_MIMETYPE = 1; // public const int HTTP_MIMETYPE = 1;
// public const int HTTP_VERIFY_CERT = 3; // public const int HTTP_VERIFY_CERT = 3;
// public const int HTTP_VERBOSE_THROTTLE = 4;
// public const int HTTP_CUSTOM_HEADER = 5;
// public const int HTTP_PRAGMA_NO_CACHE = 6;
private bool _finished; private bool _finished;
public bool Finished public bool Finished
{ {
get { return _finished; } get { return _finished; }
} }
// public int HttpBodyMaxLen = 2048; // not implemented // public int HttpBodyMaxLen = 2048; // not implemented
@ -340,11 +382,14 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
public string HttpMIMEType = "text/plain;charset=utf-8"; public string HttpMIMEType = "text/plain;charset=utf-8";
public int HttpTimeout; public int HttpTimeout;
public bool HttpVerifyCert = true; public bool HttpVerifyCert = true;
//public bool HttpVerboseThrottle = true; // not implemented
public List<string> HttpCustomHeaders = null;
public bool HttpPragmaNoCache = true;
private Thread httpThread; private Thread httpThread;
// Request info // Request info
private UUID _itemID; private UUID _itemID;
public UUID ItemID public UUID ItemID
{ {
get { return _itemID; } get { return _itemID; }
set { _itemID = value; } set { _itemID = value; }
@ -360,7 +405,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
public string proxyexcepts; public string proxyexcepts;
public string OutboundBody; public string OutboundBody;
private UUID _reqID; private UUID _reqID;
public UUID ReqID public UUID ReqID
{ {
get { return _reqID; } get { return _reqID; }
set { _reqID = value; } set { _reqID = value; }
@ -401,7 +446,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
Request.Method = HttpMethod; Request.Method = HttpMethod;
Request.ContentType = HttpMIMEType; Request.ContentType = HttpMIMEType;
if(!HttpVerifyCert) if (!HttpVerifyCert)
{ {
// We could hijack Connection Group Name to identify // We could hijack Connection Group Name to identify
// a desired security exception. But at the moment we'll use a dummy header instead. // 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
// { // {
// Request.ConnectionGroupName="Verify"; // Request.ConnectionGroupName="Verify";
// } // }
if (proxyurl != null && proxyurl.Length > 0) if (!HttpPragmaNoCache)
{ {
if (proxyexcepts != null && proxyexcepts.Length > 0) Request.Headers.Add("Pragma", "no-cache");
}
if (HttpCustomHeaders != null)
{
for (int i = 0; i < HttpCustomHeaders.Count; i += 2)
Request.Headers.Add(HttpCustomHeaders[i],
HttpCustomHeaders[i+1]);
}
if (proxyurl != null && proxyurl.Length > 0)
{
if (proxyexcepts != null && proxyexcepts.Length > 0)
{ {
string[] elist = proxyexcepts.Split(';'); string[] elist = proxyexcepts.Split(';');
Request.Proxy = new WebProxy(proxyurl, true, elist); Request.Proxy = new WebProxy(proxyurl, true, elist);
} }
else else
{ {
Request.Proxy = new WebProxy(proxyurl, true); Request.Proxy = new WebProxy(proxyurl, true);
} }
@ -432,7 +487,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
Request.Headers[entry.Key] = entry.Value; Request.Headers[entry.Key] = entry.Value;
// Encode outbound data // Encode outbound data
if (OutboundBody.Length > 0) if (OutboundBody.Length > 0)
{ {
byte[] data = Util.UTF8.GetBytes(OutboundBody); byte[] data = Util.UTF8.GetBytes(OutboundBody);

View File

@ -36,6 +36,9 @@ namespace OpenSim.Region.Framework.Interfaces
HTTP_MIMETYPE = 1, HTTP_MIMETYPE = 1,
HTTP_BODY_MAXLENGTH = 2, HTTP_BODY_MAXLENGTH = 2,
HTTP_VERIFY_CERT = 3, HTTP_VERIFY_CERT = 3,
HTTP_VERBOSE_THROTTLE = 4,
HTTP_CUSTOM_HEADER = 5,
HTTP_PRAGMA_NO_CACHE = 6
} }
public interface IHttpRequestModule public interface IHttpRequestModule

View File

@ -67,6 +67,7 @@ using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
using System.Reflection; using System.Reflection;
using System.Linq;
using PermissionMask = OpenSim.Framework.PermissionMask; using PermissionMask = OpenSim.Framework.PermissionMask;
namespace OpenSim.Region.ScriptEngine.Shared.Api namespace OpenSim.Region.ScriptEngine.Shared.Api
@ -92,8 +93,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <summary> /// <summary>
/// Used for script sleeps when we are using co-operative script termination. /// Used for script sleeps when we are using co-operative script termination.
/// </summary> /// </summary>
/// <remarks>null if co-operative script termination is not active</remarks> /// <remarks>null if co-operative script termination is not active</remarks>
WaitHandle m_coopSleepHandle; WaitHandle m_coopSleepHandle;
/// <summary> /// <summary>
/// The item that hosts this script /// The item that hosts this script
@ -119,6 +120,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp.
protected ISoundModule m_SoundModule = null; protected ISoundModule m_SoundModule = null;
//An array of HTTP/1.1 headers that are not allowed to be used
//as custom headers by llHTTPRequest.
private string[] HttpStandardHeaders =
{
"Accept", "Accept-Charset", "Accept-Encoding", "Accept-Language",
"Accept-Ranges", "Age", "Allow", "Authorization", "Cache-Control",
"Connection", "Content-Encoding", "Content-Language",
"Content-Length", "Content-Location", "Content-MD5",
"Content-Range", "Content-Type", "Date", "ETag", "Expect",
"Expires", "From", "Host", "If-Match", "If-Modified-Since",
"If-None-Match", "If-Range", "If-Unmodified-Since", "Last-Modified",
"Location", "Max-Forwards", "Pragma", "Proxy-Authenticate",
"Proxy-Authorization", "Range", "Referer", "Retry-After", "Server",
"TE", "Trailer", "Transfer-Encoding", "Upgrade", "User-Agent",
"Vary", "Via", "Warning", "WWW-Authenticate"
};
public void Initialize( public void Initialize(
IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle) IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle)
{ {
@ -303,7 +321,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// If the linkset has more than one entity and a linknum greater than zero but equal to or less than the number /// If the linkset has more than one entity and a linknum greater than zero but equal to or less than the number
/// of entities, then the entity which corresponds to that linknum is returned. /// of entities, then the entity which corresponds to that linknum is returned.
/// Otherwise, if a positive linknum is given which is greater than the number of entities in the linkset, then /// Otherwise, if a positive linknum is given which is greater than the number of entities in the linkset, then
/// null is returned. /// null is returned.
/// </param> /// </param>
public ISceneEntity GetLinkEntity(int linknum) public ISceneEntity GetLinkEntity(int linknum)
{ {
@ -1557,7 +1575,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (tex.FaceTextures[i] != null) if (tex.FaceTextures[i] != null)
{ {
tex.FaceTextures[i].Shiny = sval; tex.FaceTextures[i].Shiny = sval;
tex.FaceTextures[i].Bump = bump;; tex.FaceTextures[i].Bump = bump;
} }
tex.DefaultTexture.Shiny = sval; tex.DefaultTexture.Shiny = sval;
tex.DefaultTexture.Bump = bump; tex.DefaultTexture.Bump = bump;
@ -1666,7 +1684,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
tex.DefaultTexture.RGBA = texcolor; tex.DefaultTexture.RGBA = texcolor;
} }
part.UpdateTextureEntry(tex.GetBytes()); part.UpdateTextureEntry(tex.GetBytes());
return; return;
} }
@ -1787,7 +1805,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
rgb.x = texcolor.R; rgb.x = texcolor.R;
rgb.y = texcolor.G; rgb.y = texcolor.G;
rgb.z = texcolor.B; rgb.z = texcolor.B;
return rgb; return rgb;
} }
else else
@ -1819,12 +1837,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
UUID textureID = new UUID(); UUID textureID = new UUID();
textureID = ScriptUtils.GetAssetIdFromItemName(m_host, texture, (int)AssetType.Texture); textureID = ScriptUtils.GetAssetIdFromItemName(m_host, texture, (int)AssetType.Texture);
if (textureID == UUID.Zero) if (textureID == UUID.Zero)
{ {
if (!UUID.TryParse(texture, out textureID)) if (!UUID.TryParse(texture, out textureID))
return; return;
} }
Primitive.TextureEntry tex = part.Shape.Textures; Primitive.TextureEntry tex = part.Shape.Textures;
@ -2021,7 +2039,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// IF YOU GET REGION CROSSINGS WORKING WITH THIS FUNCTION, REPLACE THE WORKAROUND. // IF YOU GET REGION CROSSINGS WORKING WITH THIS FUNCTION, REPLACE THE WORKAROUND.
// //
// This workaround is to prevent silent failure of this function. // This workaround is to prevent silent failure of this function.
// According to the specification on the SL Wiki, providing a position outside of the // According to the specification on the SL Wiki, providing a position outside of the
if (pos.x < 0 || pos.x > Constants.RegionSize || pos.y < 0 || pos.y > Constants.RegionSize) if (pos.x < 0 || pos.x > Constants.RegionSize || pos.y < 0 || pos.y > Constants.RegionSize)
{ {
return 0; return 0;
@ -2230,7 +2248,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
return llGetRootRotation(); return llGetRootRotation();
} }
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
Quaternion q = m_host.GetWorldRotation(); Quaternion q = m_host.GetWorldRotation();
return new LSL_Rotation(q.X, q.Y, q.Z, q.W); return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
@ -2919,7 +2937,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// we need to convert from a vector describing // we need to convert from a vector describing
// the angles of rotation in radians into rotation value // the angles of rotation in radians into rotation value
LSL_Rotation rot = llEuler2Rot(angle); LSL_Rotation rot = llEuler2Rot(angle);
// Per discussion with Melanie, for non-physical objects llLookAt appears to simply // Per discussion with Melanie, for non-physical objects llLookAt appears to simply
// set the rotation of the object, copy that behavior // set the rotation of the object, copy that behavior
PhysicsActor pa = m_host.PhysActor; PhysicsActor pa = m_host.PhysActor;
@ -2996,7 +3014,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!UUID.TryParse(id, out objectID)) if (!UUID.TryParse(id, out objectID))
objectID = UUID.Zero; objectID = UUID.Zero;
if (objectID == UUID.Zero && name == "") if (objectID == UUID.Zero && name == "")
return; return;
@ -3182,19 +3200,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid; msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid;
Vector3 pos = m_host.AbsolutePosition; Vector3 pos = m_host.AbsolutePosition;
msg.binaryBucket msg.binaryBucket
= Util.StringToBytes256( = Util.StringToBytes256(
"{0}/{1}/{2}/{3}", "{0}/{1}/{2}/{3}",
World.RegionInfo.RegionName, World.RegionInfo.RegionName,
(int)Math.Floor(pos.X), (int)Math.Floor(pos.X),
(int)Math.Floor(pos.Y), (int)Math.Floor(pos.Y),
(int)Math.Floor(pos.Z)); (int)Math.Floor(pos.Z));
if (m_TransferModule != null) if (m_TransferModule != null)
{ {
m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
} }
ScriptSleep(2000); ScriptSleep(2000);
} }
@ -3319,7 +3337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llRotLookAt(LSL_Rotation target, double strength, double damping) public void llRotLookAt(LSL_Rotation target, double strength, double damping)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
// Per discussion with Melanie, for non-physical objects llLookAt appears to simply // Per discussion with Melanie, for non-physical objects llLookAt appears to simply
// set the rotation of the object, copy that behavior // set the rotation of the object, copy that behavior
PhysicsActor pa = m_host.PhysActor; PhysicsActor pa = m_host.PhysActor;
@ -4313,7 +4331,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llCollisionSound(string impact_sound, double impact_volume) public void llCollisionSound(string impact_sound, double impact_volume)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
// TODO: Parameter check logic required. // TODO: Parameter check logic required.
m_host.CollisionSound = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound); m_host.CollisionSound = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound);
m_host.CollisionSoundVolume = (float)impact_volume; m_host.CollisionSoundVolume = (float)impact_volume;
@ -5008,7 +5026,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// SL spits out an empty string for types other than key & string // SL spits out an empty string for types other than key & string
// At the time of patching, LSL_Key is currently LSL_String, // At the time of patching, LSL_Key is currently LSL_String,
// so the OR check may be a little redundant, but it's being done // so the OR check may be a little redundant, but it's being done
// for completion and should LSL_Key ever be implemented // for completion and should LSL_Key ever be implemented
// as it's own struct // as it's own struct
else if (!(src.Data[index] is LSL_String || else if (!(src.Data[index] is LSL_String ||
src.Data[index] is LSL_Key)) src.Data[index] is LSL_Key))
@ -5144,8 +5162,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
return string.Join(", ", return string.Join(", ",
(new List<object>(src.Data)).ConvertAll<string>(o => (new List<object>(src.Data)).ConvertAll<string>(o =>
{ {
return o.ToString(); return o.ToString();
}).ToArray()); }).ToArray());
@ -6188,7 +6206,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SetParticleSystem(m_host, rules); SetParticleSystem(m_host, rules);
} }
private void SetParticleSystem(SceneObjectPart part, LSL_List rules) private void SetParticleSystem(SceneObjectPart part, LSL_List rules)
{ {
if (rules.Length == 0) if (rules.Length == 0)
{ {
@ -6425,7 +6443,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.OwnerID, m_host.Name, destID, m_host.OwnerID, m_host.Name, destID,
(byte)InstantMessageDialog.TaskInventoryOffered, (byte)InstantMessageDialog.TaskInventoryOffered,
false, string.Format("'{0}'", category), false, string.Format("'{0}'", category),
// We won't go so far as to add a SLURL, but this is the format used by LL as of 2012-10-06 // We won't go so far as to add a SLURL, but this is the format used by LL as of 2012-10-06
// false, string.Format("'{0}' ( http://slurl.com/secondlife/{1}/{2}/{3}/{4} )", category, World.Name, (int)pos.X, (int)pos.Y, (int)pos.Z), // false, string.Format("'{0}' ( http://slurl.com/secondlife/{1}/{2}/{3}/{4} )", category, World.Name, (int)pos.X, (int)pos.Y, (int)pos.Z),
folderID, false, pos, folderID, false, pos,
bucket, false); bucket, false);
@ -6540,12 +6558,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llAvatarOnLinkSitTarget(int linknum) public LSL_String llAvatarOnLinkSitTarget(int linknum)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if(linknum == ScriptBaseClass.LINK_SET || if(linknum == ScriptBaseClass.LINK_SET ||
linknum == ScriptBaseClass.LINK_ALL_CHILDREN || linknum == ScriptBaseClass.LINK_ALL_CHILDREN ||
linknum == ScriptBaseClass.LINK_ALL_OTHERS) return UUID.Zero.ToString(); linknum == ScriptBaseClass.LINK_ALL_OTHERS) return UUID.Zero.ToString();
List<SceneObjectPart> parts = GetLinkParts(linknum); List<SceneObjectPart> parts = GetLinkParts(linknum);
if (parts.Count == 0) return UUID.Zero.ToString(); if (parts.Count == 0) return UUID.Zero.ToString();
return parts[0].SitTargetAvatar.ToString(); return parts[0].SitTargetAvatar.ToString();
} }
@ -6922,7 +6940,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
hollow = 0.70f; hollow = 0.70f;
} }
} }
// Otherwise, hollow is limited to 95%. // Otherwise, hollow is limited to 95%.
else else
{ {
if (hollow > 0.95f) if (hollow > 0.95f)
@ -7956,8 +7974,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_List remaining = null; LSL_List remaining = null;
while (true) while (true)
{ {
if (entity is SceneObjectPart) if (entity is SceneObjectPart)
remaining = GetPrimParams((SceneObjectPart)entity, rules, ref result); remaining = GetPrimParams((SceneObjectPart)entity, rules, ref result);
else else
remaining = GetAgentParams((ScenePresence)entity, rules, ref result); remaining = GetAgentParams((ScenePresence)entity, rules, ref result);
@ -8138,7 +8156,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
res.Add(new LSL_Float(1)); res.Add(new LSL_Float(1));
break; break;
case (int)ScriptBaseClass.PRIM_ROT_LOCAL: case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
res.Add(new LSL_Rotation(sp.Rotation)); res.Add(new LSL_Rotation(sp.Rotation));
break; break;
@ -8282,16 +8300,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0)); res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0));
// float revolutions // float revolutions
res.Add(new LSL_Float(Math.Round(Shape.PathRevolutions * 0.015d, 2, MidpointRounding.AwayFromZero)) + 1.0d); res.Add(new LSL_Float(Math.Round(Shape.PathRevolutions * 0.015d, 2, MidpointRounding.AwayFromZero)) + 1.0d);
// Slightly inaccurate, because an unsigned byte is being used to represent // Slightly inaccurate, because an unsigned byte is being used to represent
// the entire range of floating-point values from 1.0 through 4.0 (which is how // the entire range of floating-point values from 1.0 through 4.0 (which is how
// SL does it). // SL does it).
// //
// Using these formulas to store and retrieve PathRevolutions, it is not // Using these formulas to store and retrieve PathRevolutions, it is not
// possible to use all values between 1.00 and 4.00. For instance, you can't // possible to use all values between 1.00 and 4.00. For instance, you can't
// represent 1.10. You can represent 1.09 and 1.11, but not 1.10. So, if you // represent 1.10. You can represent 1.09 and 1.11, but not 1.10. So, if you
// use llSetPrimitiveParams to set revolutions to 1.10 and then retreive them // use llSetPrimitiveParams to set revolutions to 1.10 and then retreive them
// with llGetPrimitiveParams, you'll retrieve 1.09. You can also see a similar // with llGetPrimitiveParams, you'll retrieve 1.09. You can also see a similar
// behavior in the viewer as you cannot set 1.10. The viewer jumps to 1.11. // behavior in the viewer as you cannot set 1.10. The viewer jumps to 1.11.
// In SL, llSetPrimitveParams and llGetPrimitiveParams can set and get a value // In SL, llSetPrimitveParams and llGetPrimitiveParams can set and get a value
// such as 1.10. So, SL must store and retreive the actual user input rather // such as 1.10. So, SL must store and retreive the actual user input rather
@ -8528,7 +8546,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.PRIM_DESC: case (int)ScriptBaseClass.PRIM_DESC:
res.Add(new LSL_String(part.Description)); res.Add(new LSL_String(part.Description));
break; break;
case (int)ScriptBaseClass.PRIM_ROT_LOCAL: case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
res.Add(new LSL_Rotation(part.RotationOffset)); res.Add(new LSL_Rotation(part.RotationOffset));
break; break;
case (int)ScriptBaseClass.PRIM_POS_LOCAL: case (int)ScriptBaseClass.PRIM_POS_LOCAL:
@ -10415,9 +10433,60 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
IHttpRequestModule httpScriptMod = IHttpRequestModule httpScriptMod =
m_ScriptEngine.World.RequestModuleInterface<IHttpRequestModule>(); m_ScriptEngine.World.RequestModuleInterface<IHttpRequestModule>();
List<string> param = new List<string>(); List<string> param = new List<string>();
foreach (object o in parameters.Data) bool ok;
Int32 flag;
for (int i = 0; i < parameters.Data.Length; i += 2)
{ {
param.Add(o.ToString()); ok = Int32.TryParse(parameters.Data[i].ToString(), out flag);
if (!ok || flag < 0 ||
flag > (int)HttpRequestConstants.HTTP_PRAGMA_NO_CACHE)
{
throw new ScriptException("Parameter " + i.ToString() + " is an invalid flag");
}
param.Add(parameters.Data[i].ToString()); //Add parameter flag
if (flag != (int)HttpRequestConstants.HTTP_CUSTOM_HEADER)
{
param.Add(parameters.Data[i+1].ToString()); //Add parameter value
}
else
{
//Parameters are in pairs and custom header takes
//arguments in pairs so adjust for header marker.
++i;
//Maximum of 8 headers are allowed based on the
//Second Life documentation for llHTTPRequest.
for (int count = 1; count <= 8; ++count)
{
//Enough parameters remaining for (another) header?
if (parameters.Data.Length - i < 2)
{
//There must be at least one name/value pair for custom header
if (count == 1)
throw new ScriptException("Missing name/value for custom header at parameter " + i.ToString());
break;
}
if (HttpStandardHeaders.Contains(parameters.Data[i].ToString(), StringComparer.OrdinalIgnoreCase))
throw new ScriptException("Name is invalid as a custom header at parameter " + i.ToString());
param.Add(parameters.Data[i].ToString());
param.Add(parameters.Data[i+1].ToString());
//Have we reached the end of the list of headers?
//End is marked by a string with a single digit.
if (i+2 >= parameters.Data.Length ||
Char.IsDigit(parameters.Data[i].ToString()[0]))
{
break;
}
i += 2;
}
}
} }
Vector3 position = m_host.AbsolutePosition; Vector3 position = m_host.AbsolutePosition;
@ -10527,12 +10596,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide) public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y); ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y);
if (lo == null) if (lo == null)
return 0; return 0;
IPrimCounts pc = lo.PrimCounts; IPrimCounts pc = lo.PrimCounts;
if (sim_wide != ScriptBaseClass.FALSE) if (sim_wide != ScriptBaseClass.FALSE)
@ -10562,7 +10631,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
else if (category == ScriptBaseClass.PARCEL_COUNT_TEMP) else if (category == ScriptBaseClass.PARCEL_COUNT_TEMP)
return 0; // counts not implemented yet return 0; // counts not implemented yet
} }
return 0; return 0;
} }
@ -10905,7 +10974,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return ret; return ret;
} }
} }
return new LSL_List(); return new LSL_List();
} }
@ -11282,7 +11351,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Vector3 bc = group.AbsolutePosition - rayEnd; // Vector3 bc = group.AbsolutePosition - rayEnd;
double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd));
// Too far off ray, don't bother // Too far off ray, don't bother
if (d > radius) if (d > radius)
return; return;
@ -11611,7 +11680,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
else else
{ {
ScenePresence sp = World.GetScenePresence(result.ConsumerID); ScenePresence sp = World.GetScenePresence(result.ConsumerID);
/// It it a boy? a girl? /// It it a boy? a girl?
if (sp != null) if (sp != null)
itemID = sp.UUID; itemID = sp.UUID;
} }

View File

@ -355,6 +355,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int HTTP_MIMETYPE = 1; public const int HTTP_MIMETYPE = 1;
public const int HTTP_BODY_MAXLENGTH = 2; public const int HTTP_BODY_MAXLENGTH = 2;
public const int HTTP_VERIFY_CERT = 3; public const int HTTP_VERIFY_CERT = 3;
public const int HTTP_VERBOSE_THROTTLE = 4;
public const int HTTP_CUSTOM_HEADER = 5;
public const int HTTP_PRAGMA_NO_CACHE = 6;
public const int PRIM_MATERIAL = 2; public const int PRIM_MATERIAL = 2;
public const int PRIM_PHYSICS = 3; public const int PRIM_PHYSICS = 3;
@ -635,7 +638,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int TOUCH_INVALID_FACE = -1; public const int TOUCH_INVALID_FACE = -1;
public static readonly vector TOUCH_INVALID_TEXCOORD = new vector(-1.0, -1.0, 0.0); public static readonly vector TOUCH_INVALID_TEXCOORD = new vector(-1.0, -1.0, 0.0);
public static readonly vector TOUCH_INVALID_VECTOR = ZERO_VECTOR; public static readonly vector TOUCH_INVALID_VECTOR = ZERO_VECTOR;
// constants for llGetPrimMediaParams/llSetPrimMediaParams // constants for llGetPrimMediaParams/llSetPrimMediaParams
public const int PRIM_MEDIA_ALT_IMAGE_ENABLE = 0; public const int PRIM_MEDIA_ALT_IMAGE_ENABLE = 0;
public const int PRIM_MEDIA_CONTROLS = 1; public const int PRIM_MEDIA_CONTROLS = 1;
@ -652,15 +655,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int PRIM_MEDIA_WHITELIST = 12; public const int PRIM_MEDIA_WHITELIST = 12;
public const int PRIM_MEDIA_PERMS_INTERACT = 13; public const int PRIM_MEDIA_PERMS_INTERACT = 13;
public const int PRIM_MEDIA_PERMS_CONTROL = 14; public const int PRIM_MEDIA_PERMS_CONTROL = 14;
public const int PRIM_MEDIA_CONTROLS_STANDARD = 0; public const int PRIM_MEDIA_CONTROLS_STANDARD = 0;
public const int PRIM_MEDIA_CONTROLS_MINI = 1; public const int PRIM_MEDIA_CONTROLS_MINI = 1;
public const int PRIM_MEDIA_PERM_NONE = 0; public const int PRIM_MEDIA_PERM_NONE = 0;
public const int PRIM_MEDIA_PERM_OWNER = 1; public const int PRIM_MEDIA_PERM_OWNER = 1;
public const int PRIM_MEDIA_PERM_GROUP = 2; public const int PRIM_MEDIA_PERM_GROUP = 2;
public const int PRIM_MEDIA_PERM_ANYONE = 4; public const int PRIM_MEDIA_PERM_ANYONE = 4;
public const int PRIM_PHYSICS_SHAPE_TYPE = 30; public const int PRIM_PHYSICS_SHAPE_TYPE = 30;
public const int PRIM_PHYSICS_SHAPE_PRIM = 0; public const int PRIM_PHYSICS_SHAPE_PRIM = 0;
public const int PRIM_PHYSICS_SHAPE_CONVEX = 2; public const int PRIM_PHYSICS_SHAPE_CONVEX = 2;
@ -688,7 +691,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const string TEXTURE_PLYWOOD = "89556747-24cb-43ed-920b-47caed15465f"; public const string TEXTURE_PLYWOOD = "89556747-24cb-43ed-920b-47caed15465f";
public const string TEXTURE_TRANSPARENT = "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"; public const string TEXTURE_TRANSPARENT = "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903";
public const string TEXTURE_MEDIA = "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361"; public const string TEXTURE_MEDIA = "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361";
// Constants for osGetRegionStats // Constants for osGetRegionStats
public const int STATS_TIME_DILATION = 0; public const int STATS_TIME_DILATION = 0;
public const int STATS_SIM_FPS = 1; public const int STATS_SIM_FPS = 1;
@ -741,7 +744,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public static readonly LSLInteger RC_GET_ROOT_KEY = 2; public static readonly LSLInteger RC_GET_ROOT_KEY = 2;
public static readonly LSLInteger RC_GET_LINK_NUM = 4; public static readonly LSLInteger RC_GET_LINK_NUM = 4;
public static readonly LSLInteger RCERR_UNKNOWN = -1; public static readonly LSLInteger RCERR_UNKNOWN = -1;
public static readonly LSLInteger RCERR_SIM_PERF_LOW = -2; public static readonly LSLInteger RCERR_SIM_PERF_LOW = -2;
public static readonly LSLInteger RCERR_CAST_TIME_EXCEEDED = 3; public static readonly LSLInteger RCERR_CAST_TIME_EXCEEDED = 3;

View File

@ -2183,6 +2183,7 @@
<ReferencePath>../../../../../../bin/</ReferencePath> <ReferencePath>../../../../../../bin/</ReferencePath>
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="System.Data"/> <Reference name="System.Data"/>
<Reference name="System.Web"/> <Reference name="System.Web"/>
<Reference name="System.Xml"/> <Reference name="System.Xml"/>