aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-01-30 18:33:44 +0000
committerJustin Clarke Casey2008-01-30 18:33:44 +0000
commita5b719e1610ad660c1b943f4d341677b5f30305b (patch)
tree6968b0308af780fd9f32067b6e043d75837ac187
parent* Print out exception information when a mysql asset fetch fails (diff)
downloadopensim-SC_OLD-a5b719e1610ad660c1b943f4d341677b5f30305b.zip
opensim-SC_OLD-a5b719e1610ad660c1b943f4d341677b5f30305b.tar.gz
opensim-SC_OLD-a5b719e1610ad660c1b943f4d341677b5f30305b.tar.bz2
opensim-SC_OLD-a5b719e1610ad660c1b943f4d341677b5f30305b.tar.xz
* Deal with asset requests with malformed guids to the asset server in more user-friendly way than throwing an Exception
* Compact status messages to reduce verbosity and be more informative
-rw-r--r--OpenSim/Grid/AssetServer/RestService.cs19
1 files changed, 13 insertions, 6 deletions
diff --git a/OpenSim/Grid/AssetServer/RestService.cs b/OpenSim/Grid/AssetServer/RestService.cs
index 6e4ae8f..ab51b20 100644
--- a/OpenSim/Grid/AssetServer/RestService.cs
+++ b/OpenSim/Grid/AssetServer/RestService.cs
@@ -57,7 +57,6 @@ namespace OpenSim.Grid.AssetServer
57 57
58 public override byte[] Handle(string path, Stream request) 58 public override byte[] Handle(string path, Stream request)
59 { 59 {
60 MainLog.Instance.Verbose("REST", "In Handle");
61 string param = GetParam(path); 60 string param = GetParam(path);
62 byte[] result = new byte[] {}; 61 byte[] result = new byte[] {};
63 try 62 try
@@ -66,16 +65,19 @@ namespace OpenSim.Grid.AssetServer
66 65
67 if (p.Length > 0) 66 if (p.Length > 0)
68 { 67 {
69 LLUUID assetID = LLUUID.Parse(p[0]); 68 LLUUID assetID = null;
69
70 if (!LLUUID.TryParse(p[0], out assetID))
71 {
72 MainLog.Instance.Verbose("REST", "GET:/asset ignoring malformed UUID {0}", p[0]);
73 return result;
74 }
70 75
71 MainLog.Instance.Verbose("REST", "GET:/asset fetch param={0} UUID={1}", param, assetID);
72 m_stats.AddRequest(); 76 m_stats.AddRequest();
73 77
74 AssetBase asset = m_assetProvider.FetchAsset(assetID); 78 AssetBase asset = m_assetProvider.FetchAsset(assetID);
75 if (asset != null) 79 if (asset != null)
76 { 80 {
77 MainLog.Instance.Verbose("REST", "GET:/asset found {0}, {1}", assetID, asset.Name);
78
79 XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); 81 XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
80 MemoryStream ms = new MemoryStream(); 82 MemoryStream ms = new MemoryStream();
81 XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8); 83 XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8);
@@ -87,7 +89,12 @@ namespace OpenSim.Grid.AssetServer
87 //StreamReader sr = new StreamReader(ms); 89 //StreamReader sr = new StreamReader(ms);
88 90
89 result = ms.GetBuffer(); 91 result = ms.GetBuffer();
90 MainLog.Instance.Verbose("REST", "Buffer: {0}", result); 92
93 MainLog.Instance.Verbose(
94 "REST",
95 "GET:/asset found {0} with name {1}, size {2} bytes",
96 assetID, asset.Name, result.Length);
97
91 Array.Resize<byte>(ref result, (int) ms.Length); 98 Array.Resize<byte>(ref result, (int) ms.Length);
92 } 99 }
93 else 100 else