diff options
author | Justin Clarke Casey | 2008-10-15 20:24:44 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-10-15 20:24:44 +0000 |
commit | 98fdf504d9833dc8a58b141765378a1167d2c680 (patch) | |
tree | 63ad48dd1c5f902dd1d4e834126a79f290670405 /OpenSim | |
parent | * minor: comment out persisting prim inventory log messages (diff) | |
download | opensim-SC-98fdf504d9833dc8a58b141765378a1167d2c680.zip opensim-SC-98fdf504d9833dc8a58b141765378a1167d2c680.tar.gz opensim-SC-98fdf504d9833dc8a58b141765378a1167d2c680.tar.bz2 opensim-SC-98fdf504d9833dc8a58b141765378a1167d2c680.tar.xz |
* Truncate outgoing media and music urls to 254 characters.
* Hopefully this will resolve http://opensimulator.org/mantis/view.php?id=2383
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Util.cs | 40 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs | 52 |
3 files changed, 58 insertions, 52 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 28c818a..0f0aa47 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -733,46 +733,6 @@ namespace OpenSim.Framework | |||
733 | } | 733 | } |
734 | } | 734 | } |
735 | 735 | ||
736 | /* 2008-08-28-tyre: Obsolete (see LocalLoginService UserLoginService) | ||
737 | public static string[] ParseStartLocationRequest(string startLocationRequest) | ||
738 | { | ||
739 | string[] returnstring = new string[4]; | ||
740 | // format uri:RegionName&X&Y&Z | ||
741 | returnstring[0] = "last"; | ||
742 | returnstring[1] = "127"; | ||
743 | returnstring[2] = "127"; | ||
744 | returnstring[3] = "0"; | ||
745 | // This is the crappy way of doing it. | ||
746 | |||
747 | if (startLocationRequest.Contains(":") && startLocationRequest.Contains("&")) | ||
748 | { | ||
749 | //System.Console.WriteLine("StartLocationRequest Contains proper elements"); | ||
750 | |||
751 | string[] splitstr = startLocationRequest.Split(':'); //,2,StringSplitOptions.RemoveEmptyEntries); | ||
752 | |||
753 | //System.Console.WriteLine("Found " + splitstr.GetLength(0) + " elements in 1st split result"); | ||
754 | |||
755 | if (splitstr.GetLength(0) == 2) | ||
756 | { | ||
757 | string[] splitstr2 = splitstr[1].Split('&'); //, 4, StringSplitOptions.RemoveEmptyEntries); | ||
758 | |||
759 | //System.Console.WriteLine("Found " + splitstr2.GetLength(0) + " elements in 2nd split result"); | ||
760 | |||
761 | int len = Math.Min(splitstr2.GetLength(0), 4); | ||
762 | |||
763 | for (int i = 0; i < 4; ++i) | ||
764 | { | ||
765 | if (len > i) | ||
766 | { | ||
767 | returnstring[i] = splitstr2[i]; | ||
768 | } | ||
769 | } | ||
770 | } | ||
771 | } | ||
772 | return returnstring; | ||
773 | } | ||
774 | */ | ||
775 | |||
776 | public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args) | 736 | public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args) |
777 | { | 737 | { |
778 | return SendXmlRpcCommand(url, methodName, args); | 738 | return SendXmlRpcCommand(url, methodName, args); |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 198d660..2d6508a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -2474,15 +2474,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2474 | outPacket.ObjectData[0].FullID = objectID; | 2474 | outPacket.ObjectData[0].FullID = objectID; |
2475 | outPacket.ObjectData[0].OwnerID = ownerID; | 2475 | outPacket.ObjectData[0].OwnerID = ownerID; |
2476 | 2476 | ||
2477 | // Anything more than 254 will cause libsecondlife to barf | 2477 | outPacket.ObjectData[0].Text = LLUtil.StringToPacketBytes(text); |
2478 | // (libsl 1550) adds an \0 on the Utils.StringToBytes conversion if it isn't present | ||
2479 | if (text.Length > 254) | ||
2480 | { | ||
2481 | text = text.Remove(254); | ||
2482 | } | ||
2483 | |||
2484 | outPacket.ObjectData[0].Text = Utils.StringToBytes(text); | ||
2485 | |||
2486 | outPacket.ObjectData[0].TextColor[0] = color[0]; | 2478 | outPacket.ObjectData[0].TextColor[0] = color[0]; |
2487 | outPacket.ObjectData[0].TextColor[1] = color[1]; | 2479 | outPacket.ObjectData[0].TextColor[1] = color[1]; |
2488 | outPacket.ObjectData[0].TextColor[2] = color[2]; | 2480 | outPacket.ObjectData[0].TextColor[2] = color[2]; |
@@ -2943,6 +2935,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2943 | updatePacket.ParcelData.IsGroupOwned = landData.IsGroupOwned; | 2935 | updatePacket.ParcelData.IsGroupOwned = landData.IsGroupOwned; |
2944 | updatePacket.ParcelData.LandingType = (byte)landData.LandingType; | 2936 | updatePacket.ParcelData.LandingType = (byte)landData.LandingType; |
2945 | updatePacket.ParcelData.LocalID = landData.LocalID; | 2937 | updatePacket.ParcelData.LocalID = landData.LocalID; |
2938 | |||
2946 | if (landData.Area > 0) | 2939 | if (landData.Area > 0) |
2947 | { | 2940 | { |
2948 | updatePacket.ParcelData.MaxPrims = parcelObjectCapacity; | 2941 | updatePacket.ParcelData.MaxPrims = parcelObjectCapacity; |
@@ -2951,10 +2944,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2951 | { | 2944 | { |
2952 | updatePacket.ParcelData.MaxPrims = 0; | 2945 | updatePacket.ParcelData.MaxPrims = 0; |
2953 | } | 2946 | } |
2947 | |||
2954 | updatePacket.ParcelData.MediaAutoScale = landData.MediaAutoScale; | 2948 | updatePacket.ParcelData.MediaAutoScale = landData.MediaAutoScale; |
2955 | updatePacket.ParcelData.MediaID = landData.MediaID; | 2949 | updatePacket.ParcelData.MediaID = landData.MediaID; |
2956 | updatePacket.ParcelData.MediaURL = Utils.StringToBytes(landData.MediaURL); | 2950 | updatePacket.ParcelData.MediaURL = LLUtil.StringToPacketBytes(landData.MediaURL); |
2957 | updatePacket.ParcelData.MusicURL = Utils.StringToBytes(landData.MusicURL); | 2951 | updatePacket.ParcelData.MusicURL = LLUtil.StringToPacketBytes(landData.MusicURL); |
2958 | updatePacket.ParcelData.Name = Utils.StringToBytes(landData.Name); | 2952 | updatePacket.ParcelData.Name = Utils.StringToBytes(landData.Name); |
2959 | updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented | 2953 | updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented |
2960 | updatePacket.ParcelData.OtherCount = 0; //unemplemented | 2954 | updatePacket.ParcelData.OtherCount = 0; //unemplemented |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs new file mode 100644 index 0000000..d704967 --- /dev/null +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenMetaverse; | ||
29 | using System; | ||
30 | |||
31 | namespace OpenSim.Region.ClientStack.LindenUDP | ||
32 | { | ||
33 | public class LLUtil | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// Convert a string to bytes suitable for use in an LL UDP packet. | ||
37 | /// </summary> | ||
38 | /// <param name="s">Truncated to 254 characters if necessary</param> | ||
39 | /// <returns></returns> | ||
40 | public static byte[] StringToPacketBytes(string s) | ||
41 | { | ||
42 | // Anything more than 254 will cause libsecondlife to barf | ||
43 | // (libsl 1550) adds an \0 on the Utils.StringToBytes conversion if it isn't present | ||
44 | if (s.Length > 254) | ||
45 | { | ||
46 | s = s.Remove(254); | ||
47 | } | ||
48 | |||
49 | return Utils.StringToBytes(s); | ||
50 | } | ||
51 | } | ||
52 | } | ||