aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Capabilities/Handlers
diff options
context:
space:
mode:
authorMelanie Thielker2017-01-05 19:07:37 +0000
committerMelanie Thielker2017-01-05 19:07:37 +0000
commitb16abc8166c29585cb76cc55c3bdd76e5833cb4f (patch)
tree6a34f465a74b7a3a6dc00a3d7aa8dcc25ac3e3a5 /OpenSim/Capabilities/Handlers
parentMake it possible to disable the bakes module in the way it is described in co... (diff)
downloadopensim-SC_OLD-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.zip
opensim-SC_OLD-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.gz
opensim-SC_OLD-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.bz2
opensim-SC_OLD-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.xz
Massive tab and trailing space cleanup
Diffstat (limited to 'OpenSim/Capabilities/Handlers')
-rw-r--r--OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs2
-rw-r--r--OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs16
-rw-r--r--OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs2
-rw-r--r--OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventory2HandlerTests.cs2
-rw-r--r--OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs4
-rw-r--r--OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs4
-rw-r--r--OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesServerConnector.cs2
-rw-r--r--OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs12
-rw-r--r--OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs96
-rw-r--r--OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs8
-rw-r--r--OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs8
11 files changed, 78 insertions, 78 deletions
diff --git a/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs b/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs
index 426174d..5163169 100644
--- a/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs
+++ b/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs
@@ -74,7 +74,7 @@ namespace OpenSim.Capabilities.Handlers
74 74
75 int page_size = (string.IsNullOrEmpty(psize) ? 500 : Int32.Parse(psize)); 75 int page_size = (string.IsNullOrEmpty(psize) ? 500 : Int32.Parse(psize));
76 int page_number = (string.IsNullOrEmpty(pnumber) ? 1 : Int32.Parse(pnumber)); 76 int page_number = (string.IsNullOrEmpty(pnumber) ? 1 : Int32.Parse(pnumber));
77 77
78 // Full content request 78 // Full content request
79 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK; 79 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK;
80 //httpResponse.ContentLength = ??; 80 //httpResponse.ContentLength = ??;
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs
index e3a9a22..53ed115 100644
--- a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs
+++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs
@@ -43,7 +43,7 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
43 43
44namespace OpenSim.Capabilities.Handlers 44namespace OpenSim.Capabilities.Handlers
45{ 45{
46 public class FetchInvDescHandler 46 public class FetchInvDescHandler
47 { 47 {
48 private static readonly ILog m_log = 48 private static readonly ILog m_log =
49 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -53,14 +53,14 @@ namespace OpenSim.Capabilities.Handlers
53 private IScene m_Scene; 53 private IScene m_Scene;
54// private object m_fetchLock = new Object(); 54// private object m_fetchLock = new Object();
55 55
56 public FetchInvDescHandler(IInventoryService invService, ILibraryService libService, IScene s) 56 public FetchInvDescHandler(IInventoryService invService, ILibraryService libService, IScene s)
57 { 57 {
58 m_InventoryService = invService; 58 m_InventoryService = invService;
59 m_LibraryService = libService; 59 m_LibraryService = libService;
60 m_Scene = s; 60 m_Scene = s;
61 } 61 }
62 62
63 63
64 public string FetchInventoryDescendentsRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 64 public string FetchInventoryDescendentsRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
65 { 65 {
66 //m_log.DebugFormat("[XXX]: FetchInventoryDescendentsRequest in {0}, {1}", (m_Scene == null) ? "none" : m_Scene.Name, request); 66 //m_log.DebugFormat("[XXX]: FetchInventoryDescendentsRequest in {0}, {1}", (m_Scene == null) ? "none" : m_Scene.Name, request);
@@ -72,14 +72,14 @@ namespace OpenSim.Capabilities.Handlers
72 // correctly mark it as a uuid 72 // correctly mark it as a uuid
73 // 73 //
74 request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>"); 74 request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>");
75 75
76 // another hack <integer>1</integer> results in a 76 // another hack <integer>1</integer> results in a
77 // System.ArgumentException: Object type System.Int32 cannot 77 // System.ArgumentException: Object type System.Int32 cannot
78 // be converted to target type: System.Boolean 78 // be converted to target type: System.Boolean
79 // 79 //
80 request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>"); 80 request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>");
81 request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>"); 81 request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>");
82 82
83 Hashtable hash = new Hashtable(); 83 Hashtable hash = new Hashtable();
84 try 84 try
85 { 85 {
@@ -90,9 +90,9 @@ namespace OpenSim.Capabilities.Handlers
90 m_log.ErrorFormat("[WEB FETCH INV DESC HANDLER]: Fetch error: {0}{1}" + e.Message, e.StackTrace); 90 m_log.ErrorFormat("[WEB FETCH INV DESC HANDLER]: Fetch error: {0}{1}" + e.Message, e.StackTrace);
91 m_log.Error("Request: " + request); 91 m_log.Error("Request: " + request);
92 } 92 }
93 93
94 ArrayList foldersrequested = (ArrayList)hash["folders"]; 94 ArrayList foldersrequested = (ArrayList)hash["folders"];
95 95
96 string response = ""; 96 string response = "";
97 string bad_folders_response = ""; 97 string bad_folders_response = "";
98 98
@@ -516,7 +516,7 @@ from docs seems this was never a spec
516// } 516// }
517// } 517// }
518// } 518// }
519// 519//
520// foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend) 520// foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend)
521// { 521// {
522// m_log.DebugFormat( 522// m_log.DebugFormat(
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs
index 8200a96..e239a90 100644
--- a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs
+++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Capabilities.Handlers
80 { 80 {
81 // OMG!!! One by one!!! This is fallback code, in case the backend isn't updated 81 // OMG!!! One by one!!! This is fallback code, in case the backend isn't updated
82 m_log.WarnFormat("[FETCH INVENTORY HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one."); 82 m_log.WarnFormat("[FETCH INVENTORY HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one.");
83 items = new InventoryItemBase[itemsRequested.Count]; 83 items = new InventoryItemBase[itemsRequested.Count];
84 foreach (UUID id in itemIDs) 84 foreach (UUID id in itemIDs)
85 items[i++] = m_inventoryService.GetItem(m_agentID, id); 85 items[i++] = m_inventoryService.GetItem(m_agentID, id);
86 } 86 }
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventory2HandlerTests.cs b/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventory2HandlerTests.cs
index 8af3c64..94c2c89 100644
--- a/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventory2HandlerTests.cs
+++ b/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventory2HandlerTests.cs
@@ -120,7 +120,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
120 string request = "<llsd><map><key>items</key><array><map><key>item_id</key><uuid>"; 120 string request = "<llsd><map><key>items</key><array><map><key>item_id</key><uuid>";
121 request += "10000000-0000-0000-0000-000000000001"; // Notecard 1 121 request += "10000000-0000-0000-0000-000000000001"; // Notecard 1
122 request += "</uuid></map></array></map></llsd>"; 122 request += "</uuid></map></array></map></llsd>";
123 123
124 string llsdresponse = handler.FetchInventoryRequest(request, "/FETCH", string.Empty, req, resp); 124 string llsdresponse = handler.FetchInventoryRequest(request, "/FETCH", string.Empty, req, resp);
125 125
126 Assert.That(llsdresponse != null, Is.True, "Incorrect null response"); 126 Assert.That(llsdresponse != null, Is.True, "Incorrect null response");
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs b/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs
index 94eef3b..4143aa3 100644
--- a/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs
+++ b/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs
@@ -140,7 +140,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
140 string request = "<llsd><map><key>folders</key><array><map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>"; 140 string request = "<llsd><map><key>folders</key><array><map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
141 request += m_rootFolderID; 141 request += m_rootFolderID;
142 request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>"; 142 request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>";
143 143
144 string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp); 144 string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
145 145
146 Assert.That(llsdresponse != null, Is.True, "Incorrect null response"); 146 Assert.That(llsdresponse != null, Is.True, "Incorrect null response");
@@ -203,7 +203,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
203 203
204 // Make sure that the note card link is included 204 // Make sure that the note card link is included
205 Assert.That(llsdresponse.Contains("Link to notecard"), Is.True, "Link to notecard is missing"); 205 Assert.That(llsdresponse.Contains("Link to notecard"), Is.True, "Link to notecard is missing");
206 206
207 //Make sure the notecard item itself is included 207 //Make sure the notecard item itself is included
208 Assert.That(llsdresponse.Contains("Test Notecard 2"), Is.True, "Notecard 2 item (the source) is missing"); 208 Assert.That(llsdresponse.Contains("Test Notecard 2"), Is.True, "Notecard 2 item (the source) is missing");
209 209
diff --git a/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs b/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs
index 3e01bbb..41cfdb6 100644
--- a/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs
@@ -87,12 +87,12 @@ namespace OpenSim.Capabilities.Handlers
87 OSDMap osdname = new OSDMap(); 87 OSDMap osdname = new OSDMap();
88 if(parts[0] == "Unknown") 88 if(parts[0] == "Unknown")
89 { 89 {
90 osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddHours(1)); 90 osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddHours(1));
91 osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddHours(2)); 91 osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddHours(2));
92 } 92 }
93 else 93 else
94 { 94 {
95 osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddDays(8)); 95 osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddDays(8));
96 osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddMonths(1)); 96 osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddMonths(1));
97 } 97 }
98 osdname["display_name"] = OSD.FromString(kvp.Value); 98 osdname["display_name"] = OSD.FromString(kvp.Value);
diff --git a/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesServerConnector.cs b/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesServerConnector.cs
index 8f70c97..32da1c2 100644
--- a/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesServerConnector.cs
+++ b/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesServerConnector.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Capabilities.Handlers
61 61
62 if (m_UserManagement == null) 62 if (m_UserManagement == null)
63 throw new Exception(String.Format("Failed to load UserManagement from {0}; config is {1}", umService, m_ConfigName)); 63 throw new Exception(String.Format("Failed to load UserManagement from {0}; config is {1}", umService, m_ConfigName));
64 64
65 server.AddStreamHandler( 65 server.AddStreamHandler(
66 new GetDisplayNamesHandler("/CAPS/agents/", m_UserManagement, "GetDisplayNames", null)); 66 new GetDisplayNamesHandler("/CAPS/agents/", m_UserManagement, "GetDisplayNames", null));
67 } 67 }
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
index 8215124..062a842 100644
--- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Capabilities.Handlers
55 private IAssetService m_assetService; 55 private IAssetService m_assetService;
56 56
57 public const string DefaultFormat = "x-j2c"; 57 public const string DefaultFormat = "x-j2c";
58 58
59 public GetTextureHandler(IAssetService assService) 59 public GetTextureHandler(IAssetService assService)
60 { 60 {
61 m_assetService = assService; 61 m_assetService = assService;
@@ -83,7 +83,7 @@ namespace OpenSim.Capabilities.Handlers
83 if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID)) 83 if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID))
84 { 84 {
85// m_log.DebugFormat("[GETTEXTURE]: Received request for texture id {0}", textureID); 85// m_log.DebugFormat("[GETTEXTURE]: Received request for texture id {0}", textureID);
86 86
87 string[] formats; 87 string[] formats;
88 if (!string.IsNullOrEmpty(format)) 88 if (!string.IsNullOrEmpty(format))
89 { 89 {
@@ -129,7 +129,7 @@ namespace OpenSim.Capabilities.Handlers
129 } 129 }
130 130
131 /// <summary> 131 /// <summary>
132 /// 132 ///
133 /// </summary> 133 /// </summary>
134 /// <param name="httpRequest"></param> 134 /// <param name="httpRequest"></param>
135 /// <param name="httpResponse"></param> 135 /// <param name="httpResponse"></param>
@@ -190,7 +190,7 @@ namespace OpenSim.Capabilities.Handlers
190 190
191 //response = new Hashtable(); 191 //response = new Hashtable();
192 192
193 193
194 //WriteTextureData(request,response,null,format); 194 //WriteTextureData(request,response,null,format);
195 // not found 195 // not found
196 //m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found"); 196 //m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
@@ -287,7 +287,7 @@ namespace OpenSim.Capabilities.Handlers
287 response["content_type"] = texture.Metadata.ContentType; 287 response["content_type"] = texture.Metadata.ContentType;
288 else 288 else
289 response["content_type"] = "image/" + format; 289 response["content_type"] = "image/" + format;
290 290
291 response["bin_response_data"] = texture.Data; 291 response["bin_response_data"] = texture.Data;
292 response["int_bytes"] = texture.Data.Length; 292 response["int_bytes"] = texture.Data.Length;
293 293
@@ -400,7 +400,7 @@ namespace OpenSim.Capabilities.Handlers
400 400
401 if (image != null) 401 if (image != null)
402 image.Dispose(); 402 image.Dispose();
403 403
404 if(managedImage != null) 404 if(managedImage != null)
405 managedImage.Clear(); 405 managedImage.Clear();
406 if (imgstream != null) 406 if (imgstream != null)
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs
index 5f86ed4..d5df7a2 100644
--- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs
@@ -24,7 +24,7 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
@@ -44,7 +44,7 @@ using OpenSim.Framework.Servers.HttpServer;
44using OpenSim.Region.Framework.Interfaces; 44using OpenSim.Region.Framework.Interfaces;
45using OpenSim.Services.Interfaces; 45using OpenSim.Services.Interfaces;
46using Caps = OpenSim.Framework.Capabilities.Caps; 46using Caps = OpenSim.Framework.Capabilities.Caps;
47 47
48namespace OpenSim.Capabilities.Handlers 48namespace OpenSim.Capabilities.Handlers
49{ 49{
50 public class GetTextureRobustHandler : BaseStreamHandler 50 public class GetTextureRobustHandler : BaseStreamHandler
@@ -52,9 +52,9 @@ namespace OpenSim.Capabilities.Handlers
52 private static readonly ILog m_log = 52 private static readonly ILog m_log =
53 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 private IAssetService m_assetService; 54 private IAssetService m_assetService;
55 55
56 public const string DefaultFormat = "x-j2c"; 56 public const string DefaultFormat = "x-j2c";
57 57
58 // TODO: Change this to a config option 58 // TODO: Change this to a config option
59 private string m_RedirectURL = null; 59 private string m_RedirectURL = null;
60 60
@@ -66,28 +66,28 @@ namespace OpenSim.Capabilities.Handlers
66 if (m_RedirectURL != null && !m_RedirectURL.EndsWith("/")) 66 if (m_RedirectURL != null && !m_RedirectURL.EndsWith("/"))
67 m_RedirectURL += "/"; 67 m_RedirectURL += "/";
68 } 68 }
69 69
70 protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 70 protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
71 { 71 {
72 // Try to parse the texture ID from the request URL 72 // Try to parse the texture ID from the request URL
73 NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); 73 NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
74 string textureStr = query.GetOne("texture_id"); 74 string textureStr = query.GetOne("texture_id");
75 string format = query.GetOne("format"); 75 string format = query.GetOne("format");
76 76
77 //m_log.DebugFormat("[GETTEXTURE]: called {0}", textureStr); 77 //m_log.DebugFormat("[GETTEXTURE]: called {0}", textureStr);
78 78
79 if (m_assetService == null) 79 if (m_assetService == null)
80 { 80 {
81 m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service"); 81 m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service");
82 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; 82 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
83 return null; 83 return null;
84 } 84 }
85 85
86 UUID textureID; 86 UUID textureID;
87 if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID)) 87 if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID))
88 { 88 {
89// m_log.DebugFormat("[GETTEXTURE]: Received request for texture id {0}", textureID); 89// m_log.DebugFormat("[GETTEXTURE]: Received request for texture id {0}", textureID);
90 90
91 string[] formats; 91 string[] formats;
92 if (!string.IsNullOrEmpty(format)) 92 if (!string.IsNullOrEmpty(format))
93 { 93 {
@@ -98,10 +98,10 @@ namespace OpenSim.Capabilities.Handlers
98 formats = WebUtil.GetPreferredImageTypes(httpRequest.Headers.Get("Accept")); 98 formats = WebUtil.GetPreferredImageTypes(httpRequest.Headers.Get("Accept"));
99 if (formats.Length == 0) 99 if (formats.Length == 0)
100 formats = new string[1] { DefaultFormat }; // default 100 formats = new string[1] { DefaultFormat }; // default
101 101
102 } 102 }
103 // OK, we have an array with preferred formats, possibly with only one entry 103 // OK, we have an array with preferred formats, possibly with only one entry
104 104
105 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; 105 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
106 foreach (string f in formats) 106 foreach (string f in formats)
107 { 107 {
@@ -113,14 +113,14 @@ namespace OpenSim.Capabilities.Handlers
113 { 113 {
114 m_log.Warn("[GETTEXTURE]: Failed to parse a texture_id from GetTexture request: " + httpRequest.Url); 114 m_log.Warn("[GETTEXTURE]: Failed to parse a texture_id from GetTexture request: " + httpRequest.Url);
115 } 115 }
116 116
117// m_log.DebugFormat( 117// m_log.DebugFormat(
118// "[GETTEXTURE]: For texture {0} sending back response {1}, data length {2}", 118// "[GETTEXTURE]: For texture {0} sending back response {1}, data length {2}",
119// textureID, httpResponse.StatusCode, httpResponse.ContentLength); 119// textureID, httpResponse.StatusCode, httpResponse.ContentLength);
120 120
121 return null; 121 return null;
122 } 122 }
123 123
124 /// <summary> 124 /// <summary>
125 /// 125 ///
126 /// </summary> 126 /// </summary>
@@ -133,16 +133,16 @@ namespace OpenSim.Capabilities.Handlers
133 { 133 {
134// m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format); 134// m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format);
135 AssetBase texture; 135 AssetBase texture;
136 136
137 string fullID = textureID.ToString(); 137 string fullID = textureID.ToString();
138 if (format != DefaultFormat) 138 if (format != DefaultFormat)
139 fullID = fullID + "-" + format; 139 fullID = fullID + "-" + format;
140 140
141 if (!String.IsNullOrEmpty(m_RedirectURL)) 141 if (!String.IsNullOrEmpty(m_RedirectURL))
142 { 142 {
143 // Only try to fetch locally cached textures. Misses are redirected 143 // Only try to fetch locally cached textures. Misses are redirected
144 texture = m_assetService.GetCached(fullID); 144 texture = m_assetService.GetCached(fullID);
145 145
146 if (texture != null) 146 if (texture != null)
147 { 147 {
148 if (texture.Type != (sbyte)AssetType.Texture) 148 if (texture.Type != (sbyte)AssetType.Texture)
@@ -166,14 +166,14 @@ namespace OpenSim.Capabilities.Handlers
166 { 166 {
167 // try the cache 167 // try the cache
168 texture = m_assetService.GetCached(fullID); 168 texture = m_assetService.GetCached(fullID);
169 169
170 if (texture == null) 170 if (texture == null)
171 { 171 {
172// m_log.DebugFormat("[GETTEXTURE]: texture was not in the cache"); 172// m_log.DebugFormat("[GETTEXTURE]: texture was not in the cache");
173 173
174 // Fetch locally or remotely. Misses return a 404 174 // Fetch locally or remotely. Misses return a 404
175 texture = m_assetService.Get(textureID.ToString()); 175 texture = m_assetService.Get(textureID.ToString());
176 176
177 if (texture != null) 177 if (texture != null)
178 { 178 {
179 if (texture.Type != (sbyte)AssetType.Texture) 179 if (texture.Type != (sbyte)AssetType.Texture)
@@ -192,7 +192,7 @@ namespace OpenSim.Capabilities.Handlers
192 newTexture.Data = ConvertTextureData(texture, format); 192 newTexture.Data = ConvertTextureData(texture, format);
193 if (newTexture.Data.Length == 0) 193 if (newTexture.Data.Length == 0)
194 return false; // !!! Caller try another codec, please! 194 return false; // !!! Caller try another codec, please!
195 195
196 newTexture.Flags = AssetFlags.Collectable; 196 newTexture.Flags = AssetFlags.Collectable;
197 newTexture.Temporary = true; 197 newTexture.Temporary = true;
198 newTexture.Local = true; 198 newTexture.Local = true;
@@ -209,17 +209,17 @@ namespace OpenSim.Capabilities.Handlers
209 return true; 209 return true;
210 } 210 }
211 } 211 }
212 212
213 // not found 213 // not found
214// m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found"); 214// m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
215 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; 215 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
216 return true; 216 return true;
217 } 217 }
218 218
219 private void WriteTextureData(IOSHttpRequest request, IOSHttpResponse response, AssetBase texture, string format) 219 private void WriteTextureData(IOSHttpRequest request, IOSHttpResponse response, AssetBase texture, string format)
220 { 220 {
221 string range = request.Headers.GetOne("Range"); 221 string range = request.Headers.GetOne("Range");
222 222
223 if (!String.IsNullOrEmpty(range)) // JP2's only 223 if (!String.IsNullOrEmpty(range)) // JP2's only
224 { 224 {
225 // Range request 225 // Range request
@@ -233,7 +233,7 @@ namespace OpenSim.Capabilities.Handlers
233// m_log.DebugFormat( 233// m_log.DebugFormat(
234// "[GETTEXTURE]: Client requested range for texture {0} starting at {1} but texture has end of {2}", 234// "[GETTEXTURE]: Client requested range for texture {0} starting at {1} but texture has end of {2}",
235// texture.ID, start, texture.Data.Length); 235// texture.ID, start, texture.Data.Length);
236 236
237 // Stricly speaking, as per http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html, we should be sending back 237 // Stricly speaking, as per http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html, we should be sending back
238 // Requested Range Not Satisfiable (416) here. However, it appears that at least recent implementations 238 // Requested Range Not Satisfiable (416) here. However, it appears that at least recent implementations
239 // of the Linden Lab viewer (3.2.1 and 3.3.4 and probably earlier), a viewer that has previously 239 // of the Linden Lab viewer (3.2.1 and 3.3.4 and probably earlier), a viewer that has previously
@@ -244,7 +244,7 @@ namespace OpenSim.Capabilities.Handlers
244 // level 2. If this estimate is greater than the total texture size, returning a RequestedRangeNotSatisfiable 244 // level 2. If this estimate is greater than the total texture size, returning a RequestedRangeNotSatisfiable
245 // here will cause the viewer to treat the texture as bad and never display the full resolution 245 // here will cause the viewer to treat the texture as bad and never display the full resolution
246 // However, if we return PartialContent (or OK) instead, the viewer will display that resolution. 246 // However, if we return PartialContent (or OK) instead, the viewer will display that resolution.
247 247
248// response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable; 248// response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
249// response.AddHeader("Content-Range", String.Format("bytes */{0}", texture.Data.Length)); 249// response.AddHeader("Content-Range", String.Format("bytes */{0}", texture.Data.Length));
250// response.StatusCode = (int)System.Net.HttpStatusCode.OK; 250// response.StatusCode = (int)System.Net.HttpStatusCode.OK;
@@ -257,13 +257,13 @@ namespace OpenSim.Capabilities.Handlers
257 // the rest of the entity. 257 // the rest of the entity.
258 if (end == -1) 258 if (end == -1)
259 end = int.MaxValue; 259 end = int.MaxValue;
260 260
261 end = Utils.Clamp(end, 0, texture.Data.Length - 1); 261 end = Utils.Clamp(end, 0, texture.Data.Length - 1);
262 start = Utils.Clamp(start, 0, end); 262 start = Utils.Clamp(start, 0, end);
263 int len = end - start + 1; 263 int len = end - start + 1;
264 264
265// m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); 265// m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
266 266
267 // Always return PartialContent, even if the range covered the entire data length 267 // Always return PartialContent, even if the range covered the entire data length
268 // We were accidentally sending back 404 before in this situation 268 // We were accidentally sending back 404 before in this situation
269 // https://issues.apache.org/bugzilla/show_bug.cgi?id=51878 supports sending 206 even if the 269 // https://issues.apache.org/bugzilla/show_bug.cgi?id=51878 supports sending 206 even if the
@@ -275,11 +275,11 @@ namespace OpenSim.Capabilities.Handlers
275// response.StatusCode = (int)System.Net.HttpStatusCode.OK; 275// response.StatusCode = (int)System.Net.HttpStatusCode.OK;
276// else 276// else
277 response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent; 277 response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
278 278
279 response.ContentLength = len; 279 response.ContentLength = len;
280 response.ContentType = texture.Metadata.ContentType; 280 response.ContentType = texture.Metadata.ContentType;
281 response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length)); 281 response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length));
282 282
283 response.Body.Write(texture.Data, start, len); 283 response.Body.Write(texture.Data, start, len);
284 } 284 }
285 } 285 }
@@ -300,7 +300,7 @@ namespace OpenSim.Capabilities.Handlers
300 response.ContentType = "image/" + format; 300 response.ContentType = "image/" + format;
301 response.Body.Write(texture.Data, 0, texture.Data.Length); 301 response.Body.Write(texture.Data, 0, texture.Data.Length);
302 } 302 }
303 303
304// if (response.StatusCode < 200 || response.StatusCode > 299) 304// if (response.StatusCode < 200 || response.StatusCode > 299)
305// m_log.WarnFormat( 305// m_log.WarnFormat(
306// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})", 306// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
@@ -310,7 +310,7 @@ namespace OpenSim.Capabilities.Handlers
310// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})", 310// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
311// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length); 311// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
312 } 312 }
313 313
314 /// <summary> 314 /// <summary>
315 /// Parse a range header. 315 /// Parse a range header.
316 /// </summary> 316 /// </summary>
@@ -327,18 +327,18 @@ namespace OpenSim.Capabilities.Handlers
327 private bool TryParseRange(string header, out int start, out int end) 327 private bool TryParseRange(string header, out int start, out int end)
328 { 328 {
329 start = end = 0; 329 start = end = 0;
330 330
331 if (header.StartsWith("bytes=")) 331 if (header.StartsWith("bytes="))
332 { 332 {
333 string[] rangeValues = header.Substring(6).Split('-'); 333 string[] rangeValues = header.Substring(6).Split('-');
334 334
335 if (rangeValues.Length == 2) 335 if (rangeValues.Length == 2)
336 { 336 {
337 if (!Int32.TryParse(rangeValues[0], out start)) 337 if (!Int32.TryParse(rangeValues[0], out start))
338 return false; 338 return false;
339 339
340 string rawEnd = rangeValues[1]; 340 string rawEnd = rangeValues[1];
341 341
342 if (rawEnd == "") 342 if (rawEnd == "")
343 { 343 {
344 end = -1; 344 end = -1;
@@ -350,27 +350,27 @@ namespace OpenSim.Capabilities.Handlers
350 } 350 }
351 } 351 }
352 } 352 }
353 353
354 start = end = 0; 354 start = end = 0;
355 return false; 355 return false;
356 } 356 }
357 357
358 private byte[] ConvertTextureData(AssetBase texture, string format) 358 private byte[] ConvertTextureData(AssetBase texture, string format)
359 { 359 {
360 m_log.DebugFormat("[GETTEXTURE]: Converting texture {0} to {1}", texture.ID, format); 360 m_log.DebugFormat("[GETTEXTURE]: Converting texture {0} to {1}", texture.ID, format);
361 byte[] data = new byte[0]; 361 byte[] data = new byte[0];
362 362
363 MemoryStream imgstream = new MemoryStream(); 363 MemoryStream imgstream = new MemoryStream();
364 Bitmap mTexture = null; 364 Bitmap mTexture = null;
365 ManagedImage managedImage = null; 365 ManagedImage managedImage = null;
366 Image image = null; 366 Image image = null;
367 367
368 try 368 try
369 { 369 {
370 // Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data 370 // Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
371 371
372 imgstream = new MemoryStream(); 372 imgstream = new MemoryStream();
373 373
374 // Decode image to System.Drawing.Image 374 // Decode image to System.Drawing.Image
375 if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null) 375 if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null)
376 { 376 {
@@ -380,7 +380,7 @@ namespace OpenSim.Capabilities.Handlers
380 using(EncoderParameters myEncoderParameters = new EncoderParameters()) 380 using(EncoderParameters myEncoderParameters = new EncoderParameters())
381 { 381 {
382 myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Quality,95L); 382 myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Quality,95L);
383 383
384 // Save bitmap to stream 384 // Save bitmap to stream
385 ImageCodecInfo codec = GetEncoderInfo("image/" + format); 385 ImageCodecInfo codec = GetEncoderInfo("image/" + format);
386 if (codec != null) 386 if (codec != null)
@@ -404,10 +404,10 @@ namespace OpenSim.Capabilities.Handlers
404 // If we encountered an exception, one or more of these will be null 404 // If we encountered an exception, one or more of these will be null
405 if (mTexture != null) 405 if (mTexture != null)
406 mTexture.Dispose(); 406 mTexture.Dispose();
407 407
408 if (image != null) 408 if (image != null)
409 image.Dispose(); 409 image.Dispose();
410 410
411 if(managedImage != null) 411 if(managedImage != null)
412 managedImage.Clear(); 412 managedImage.Clear();
413 413
@@ -417,10 +417,10 @@ namespace OpenSim.Capabilities.Handlers
417 imgstream.Dispose(); 417 imgstream.Dispose();
418 } 418 }
419 } 419 }
420 420
421 return data; 421 return data;
422 } 422 }
423 423
424 // From msdn 424 // From msdn
425 private static ImageCodecInfo GetEncoderInfo(String mimeType) 425 private static ImageCodecInfo GetEncoderInfo(String mimeType)
426 { 426 {
diff --git a/OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs b/OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs
index f628ac1..387b3de 100644
--- a/OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs
+++ b/OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs
@@ -2,7 +2,7 @@
2using System.Runtime.CompilerServices; 2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4 4
5// General Information about an assembly is controlled through the following 5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly. 7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Capabilities.Handlers")] 8[assembly: AssemblyTitle("OpenSim.Capabilities.Handlers")]
@@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
14[assembly: AssemblyTrademark("")] 14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")] 15[assembly: AssemblyCulture("")]
16 16
17// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)] 20[assembly: ComVisible(false)]
21 21
@@ -25,7 +25,7 @@ using System.Runtime.InteropServices;
25// Version information for an assembly consists of the following four values: 25// Version information for an assembly consists of the following four values:
26// 26//
27// Major Version 27// Major Version
28// Minor Version 28// Minor Version
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs
index 5536564..80b8306 100644
--- a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs
+++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Capabilities.Handlers
51{ 51{
52 public class UploadBakedTextureHandler 52 public class UploadBakedTextureHandler
53 { 53 {
54 54
55 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 55 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
56 56
57 private Caps m_HostCapsObj; 57 private Caps m_HostCapsObj;
@@ -81,7 +81,7 @@ namespace OpenSim.Capabilities.Handlers
81 { 81 {
82 string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; 82 string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
83 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 83 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
84 84
85 BakedTextureUploader uploader = 85 BakedTextureUploader uploader =
86 new BakedTextureUploader(capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_HostCapsObj.AgentID); 86 new BakedTextureUploader(capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_HostCapsObj.AgentID);
87 uploader.OnUpLoad += BakedTextureUploaded; 87 uploader.OnUpLoad += BakedTextureUploaded;
@@ -127,7 +127,7 @@ namespace OpenSim.Capabilities.Handlers
127 asset.Temporary = true; 127 asset.Temporary = true;
128 asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are 128 asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are
129 m_assetService.Store(asset); 129 m_assetService.Store(asset);
130 130
131 } 131 }
132 } 132 }
133 133
@@ -151,7 +151,7 @@ namespace OpenSim.Capabilities.Handlers
151 // m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID); 151 // m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
152 } 152 }
153 153
154 154
155 155
156 /// <summary> 156 /// <summary>
157 /// Handle raw uploaded baked texture data. 157 /// Handle raw uploaded baked texture data.