aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorMelanie2013-03-29 23:28:47 +0000
committerMelanie2013-03-29 23:28:47 +0000
commitd5d6a274a7ab9781585cb0a239a3c5f5d3cb6007 (patch)
tree71a5d8cb9168ee3946cbce3afb5354eb7cfa407d /OpenSim/Region/CoreModules
parentMerge commit '23ae4c0a4d813763bcc39db7693850a21727d7f2' into careminster (diff)
parentAdded missing functionality (mainly custom headers) to llHTTPRequest. (diff)
downloadopensim-SC-d5d6a274a7ab9781585cb0a239a3c5f5d3cb6007.zip
opensim-SC-d5d6a274a7ab9781585cb0a239a3c5f5d3cb6007.tar.gz
opensim-SC-d5d6a274a7ab9781585cb0a239a3c5f5d3cb6007.tar.bz2
opensim-SC-d5d6a274a7ab9781585cb0a239a3c5f5d3cb6007.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs35
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs6
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs79
3 files changed, 90 insertions, 30 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 9d7b44b..5d72af8 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -301,10 +301,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
301 301
302 // If we're an NPC then skip all the item checks and manipulations since we don't have an 302 // If we're an NPC then skip all the item checks and manipulations since we don't have an
303 // inventory right now. 303 // inventory right now.
304 if (sp.PresenceType == PresenceType.Npc) 304 RezSingleAttachmentFromInventoryInternal(sp, sp.PresenceType == PresenceType.Npc ? UUID.Zero : attach.ItemID, attach.AssetID, p | (uint)0x80, null);
305 RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p, null, true);
306 else
307 RezSingleAttachmentFromInventory(sp, attach.ItemID, p | (uint)0x80, d);
308 } 305 }
309 catch (Exception e) 306 catch (Exception e)
310 { 307 {
@@ -519,26 +516,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
519 "[ATTACHMENTS MODULE]: RezSingleAttachmentFromInventory to point {0} from item {1} for {2} in {3}", 516 "[ATTACHMENTS MODULE]: RezSingleAttachmentFromInventory to point {0} from item {1} for {2} in {3}",
520 (AttachmentPoint)AttachmentPt, itemID, sp.Name, m_scene.Name); 517 (AttachmentPoint)AttachmentPt, itemID, sp.Name, m_scene.Name);
521 518
522 bool append = (AttachmentPt & 0x80) != 0; 519 // We check the attachments in the avatar appearance here rather than the objects attached to the
523 AttachmentPt &= 0x7f; 520 // ScenePresence itself so that we can ignore calls by viewer 2/3 to attach objects on startup. We are
524 521 // already doing this in ScenePresence.MakeRootAgent(). Simulator-side attaching needs to be done
525 // Viewer 2/3 sometimes asks to re-wear items that are already worn (and show up in it's inventory as such). 522 // because pre-outfit folder viewers (most version 1 viewers) require it.
526 // This often happens during login - not sure the exact reason.
527 // For now, we will ignore the request. Unfortunately, this means that we need to dig through all the
528 // ScenePresence attachments. We can't use the data in AvatarAppearance because that's present at login
529 // before anything has actually been attached.
530 bool alreadyOn = false; 523 bool alreadyOn = false;
531 List<SceneObjectGroup> existingAttachments = sp.GetAttachments(); 524 List<AvatarAttachment> existingAttachments = sp.Appearance.GetAttachments();
532 foreach (SceneObjectGroup so in existingAttachments) 525 foreach (AvatarAttachment existingAttachment in existingAttachments)
533 { 526 {
534 if (so.FromItemID == itemID) 527 if (existingAttachment.ItemID == itemID)
535 { 528 {
536 alreadyOn = true; 529 alreadyOn = true;
537 break; 530 break;
538 } 531 }
539 } 532 }
540 533
541// if (sp.Appearance.GetAttachmentForItem(itemID) != null)
542 if (alreadyOn) 534 if (alreadyOn)
543 { 535 {
544 if (DebugLevel > 0) 536 if (DebugLevel > 0)
@@ -549,7 +541,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
549 return null; 541 return null;
550 } 542 }
551 543
552 return RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, doc, append); 544 return RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, doc);
553 } 545 }
554 546
555 public void RezMultipleAttachmentsFromInventory(IScenePresence sp, List<KeyValuePair<UUID, uint>> rezlist) 547 public void RezMultipleAttachmentsFromInventory(IScenePresence sp, List<KeyValuePair<UUID, uint>> rezlist)
@@ -558,7 +550,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
558 return; 550 return;
559 551
560 if (DebugLevel > 0) 552 if (DebugLevel > 0)
561 m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing multiple attachments from inventory for {0}", sp.Name); 553 m_log.DebugFormat(
554 "[ATTACHMENTS MODULE]: Rezzing {0} attachments from inventory for {1} in {2}",
555 rezlist.Count, sp.Name, m_scene.Name);
562 556
563 foreach (KeyValuePair<UUID, uint> rez in rezlist) 557 foreach (KeyValuePair<UUID, uint> rez in rezlist)
564 { 558 {
@@ -957,11 +951,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
957 } 951 }
958 952
959 protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( 953 protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
960 IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc, bool append) 954 IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc)
961 { 955 {
962 if (m_invAccessModule == null) 956 if (m_invAccessModule == null)
963 return null; 957 return null;
964 958
959 bool append = (attachmentPt & 0x80) != 0;
960 attachmentPt &= 0x7f;
961
965 SceneObjectGroup objatt; 962 SceneObjectGroup objatt;
966 963
967 if (itemID != UUID.Zero) 964 if (itemID != UUID.Zero)
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index cfe5538..1a38619 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -130,7 +130,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
130 config.AddConfig("Modules"); 130 config.AddConfig("Modules");
131 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); 131 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
132 132
133 modules.Add(new AttachmentsModule()); 133 AttachmentsModule attMod = new AttachmentsModule();
134 attMod.DebugLevel = 1;
135 modules.Add(attMod);
134 modules.Add(new BasicInventoryAccessModule()); 136 modules.Add(new BasicInventoryAccessModule());
135 } 137 }
136 138
@@ -728,7 +730,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
728 public void TestRezAttachmentsOnAvatarEntrance() 730 public void TestRezAttachmentsOnAvatarEntrance()
729 { 731 {
730 TestHelpers.InMethod(); 732 TestHelpers.InMethod();
731// log4net.Config.XmlConfigurator.Configure(); 733// TestHelpers.EnableLogging();
732 734
733 Scene scene = CreateTestScene(); 735 Scene scene = CreateTestScene();
734 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); 736 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index 0276267..2b13a8b 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -189,6 +189,45 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
189 case (int)HttpRequestConstants.HTTP_VERIFY_CERT: 189 case (int)HttpRequestConstants.HTTP_VERIFY_CERT:
190 htc.HttpVerifyCert = (int.Parse(parms[i + 1]) != 0); 190 htc.HttpVerifyCert = (int.Parse(parms[i + 1]) != 0);
191 break; 191 break;
192
193 case (int)HttpRequestConstants.HTTP_VERBOSE_THROTTLE:
194
195 // TODO implement me
196 break;
197
198 case (int)HttpRequestConstants.HTTP_CUSTOM_HEADER:
199 //Parameters are in pairs and custom header takes
200 //arguments in pairs so adjust for header marker.
201 ++i;
202
203 //Maximum of 8 headers are allowed based on the
204 //Second Life documentation for llHTTPRequest.
205 for (int count = 1; count <= 8; ++count)
206 {
207 //Not enough parameters remaining for a header?
208 if (parms.Length - i < 2)
209 break;
210
211 //Have we reached the end of the list of headers?
212 //End is marked by a string with a single digit.
213 //We already know we have at least one parameter
214 //so it is safe to do this check at top of loop.
215 if (Char.IsDigit(parms[i][0]))
216 break;
217
218 if (htc.HttpCustomHeaders == null)
219 htc.HttpCustomHeaders = new List<string>();
220
221 htc.HttpCustomHeaders.Add(parms[i]);
222 htc.HttpCustomHeaders.Add(parms[i+1]);
223
224 i += 2;
225 }
226 break;
227
228 case (int)HttpRequestConstants.HTTP_PRAGMA_NO_CACHE:
229 htc.HttpPragmaNoCache = (int.Parse(parms[i + 1]) != 0);
230 break;
192 } 231 }
193 } 232 }
194 } 233 }
@@ -353,9 +392,12 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
353 // public const int HTTP_METHOD = 0; 392 // public const int HTTP_METHOD = 0;
354 // public const int HTTP_MIMETYPE = 1; 393 // public const int HTTP_MIMETYPE = 1;
355 // public const int HTTP_VERIFY_CERT = 3; 394 // public const int HTTP_VERIFY_CERT = 3;
395 // public const int HTTP_VERBOSE_THROTTLE = 4;
396 // public const int HTTP_CUSTOM_HEADER = 5;
397 // public const int HTTP_PRAGMA_NO_CACHE = 6;
356 private bool _finished; 398 private bool _finished;
357 public bool Finished 399 public bool Finished
358 { 400 {
359 get { return _finished; } 401 get { return _finished; }
360 } 402 }
361 // public int HttpBodyMaxLen = 2048; // not implemented 403 // public int HttpBodyMaxLen = 2048; // not implemented
@@ -367,9 +409,14 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
367 public bool HttpVerifyCert = true; 409 public bool HttpVerifyCert = true;
368 public IWorkItemResult WorkItem = null; 410 public IWorkItemResult WorkItem = null;
369 411
412 //public bool HttpVerboseThrottle = true; // not implemented
413 public List<string> HttpCustomHeaders = null;
414 public bool HttpPragmaNoCache = true;
415 private Thread httpThread;
416
370 // Request info 417 // Request info
371 private UUID _itemID; 418 private UUID _itemID;
372 public UUID ItemID 419 public UUID ItemID
373 { 420 {
374 get { return _itemID; } 421 get { return _itemID; }
375 set { _itemID = value; } 422 set { _itemID = value; }
@@ -385,7 +432,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
385 public string proxyexcepts; 432 public string proxyexcepts;
386 public string OutboundBody; 433 public string OutboundBody;
387 private UUID _reqID; 434 private UUID _reqID;
388 public UUID ReqID 435 public UUID ReqID
389 { 436 {
390 get { return _reqID; } 437 get { return _reqID; }
391 set { _reqID = value; } 438 set { _reqID = value; }
@@ -434,20 +481,34 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
434 Request.Method = HttpMethod; 481 Request.Method = HttpMethod;
435 Request.ContentType = HttpMIMEType; 482 Request.ContentType = HttpMIMEType;
436 483
437 if(!HttpVerifyCert) 484 if (!HttpVerifyCert)
438 { 485 {
439 // We could hijack Connection Group Name to identify 486 // We could hijack Connection Group Name to identify
440 // a desired security exception. But at the moment we'll use a dummy header instead. 487 // a desired security exception. But at the moment we'll use a dummy header instead.
441 Request.Headers.Add("NoVerifyCert", "true"); 488 Request.Headers.Add("NoVerifyCert", "true");
442 } 489 }
443 if (proxyurl != null && proxyurl.Length > 0) 490// else
491// {
492// Request.ConnectionGroupName="Verify";
493// }
494 if (!HttpPragmaNoCache)
495 {
496 Request.Headers.Add("Pragma", "no-cache");
497 }
498 if (HttpCustomHeaders != null)
444 { 499 {
445 if (proxyexcepts != null && proxyexcepts.Length > 0) 500 for (int i = 0; i < HttpCustomHeaders.Count; i += 2)
501 Request.Headers.Add(HttpCustomHeaders[i],
502 HttpCustomHeaders[i+1]);
503 }
504 if (proxyurl != null && proxyurl.Length > 0)
505 {
506 if (proxyexcepts != null && proxyexcepts.Length > 0)
446 { 507 {
447 string[] elist = proxyexcepts.Split(';'); 508 string[] elist = proxyexcepts.Split(';');
448 Request.Proxy = new WebProxy(proxyurl, true, elist); 509 Request.Proxy = new WebProxy(proxyurl, true, elist);
449 } 510 }
450 else 511 else
451 { 512 {
452 Request.Proxy = new WebProxy(proxyurl, true); 513 Request.Proxy = new WebProxy(proxyurl, true);
453 } 514 }
@@ -460,7 +521,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
460 Request.Headers[entry.Key] = entry.Value; 521 Request.Headers[entry.Key] = entry.Value;
461 522
462 // Encode outbound data 523 // Encode outbound data
463 if (OutboundBody.Length > 0) 524 if (OutboundBody.Length > 0)
464 { 525 {
465 byte[] data = Util.UTF8.GetBytes(OutboundBody); 526 byte[] data = Util.UTF8.GetBytes(OutboundBody);
466 527