aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2018-07-14 14:22:52 +0100
committerUbitUmarov2018-07-14 14:22:52 +0100
commitf17b48e73e2fa58e536d96b31c94468e018c1272 (patch)
tree617bcad371e1c829b967b9d1e9a2c51a38afccc1
parentdrop compatibility with old robust that did not suport inventoryService.GetMu... (diff)
downloadopensim-SC-f17b48e73e2fa58e536d96b31c94468e018c1272.zip
opensim-SC-f17b48e73e2fa58e536d96b31c94468e018c1272.tar.gz
opensim-SC-f17b48e73e2fa58e536d96b31c94468e018c1272.tar.bz2
opensim-SC-f17b48e73e2fa58e536d96b31c94468e018c1272.tar.xz
some cleanup
-rw-r--r--OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs56
1 files changed, 26 insertions, 30 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs
index 0685c5e..a9b3d48 100644
--- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs
@@ -131,9 +131,7 @@ namespace OpenSim.Capabilities.Handlers
131 /// <returns>False for "caller try another codec"; true otherwise</returns> 131 /// <returns>False for "caller try another codec"; true otherwise</returns>
132 private bool FetchTexture(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, UUID textureID, string format) 132 private bool FetchTexture(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, UUID textureID, string format)
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;
136
137 if(!String.IsNullOrEmpty(m_RedirectURL)) 135 if(!String.IsNullOrEmpty(m_RedirectURL))
138 { 136 {
139 string textureUrl = m_RedirectURL + "?texture_id=" + textureID.ToString(); 137 string textureUrl = m_RedirectURL + "?texture_id=" + textureID.ToString();
@@ -142,39 +140,37 @@ namespace OpenSim.Capabilities.Handlers
142 httpResponse.RedirectLocation = textureUrl; 140 httpResponse.RedirectLocation = textureUrl;
143 return true; 141 return true;
144 } 142 }
145 else // no redirect 143
144 // Fetch, Misses or invalid return a 404
145 AssetBase texture = m_assetService.Get(textureID.ToString());
146 if (texture != null)
146 { 147 {
147 texture = m_assetService.Get(textureID.ToString()); 148 if (texture.Type != (sbyte)AssetType.Texture)
148 if(texture != null)
149 { 149 {
150 if(texture.Type != (sbyte)AssetType.Texture) 150 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
151 { 151 return true;
152 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
153 return true;
154 }
155 if(format == DefaultFormat)
156 {
157 WriteTextureData(httpRequest, httpResponse, texture, format);
158 return true;
159 }
160 else
161 {
162 AssetBase newTexture = new AssetBase(texture.ID + "-" + format, texture.Name, (sbyte)AssetType.Texture, texture.Metadata.CreatorID);
163 newTexture.Data = ConvertTextureData(texture, format);
164 if(newTexture.Data.Length == 0)
165 return false; // !!! Caller try another codec, please!
166
167 newTexture.Flags = AssetFlags.Collectable;
168 newTexture.Temporary = true;
169 newTexture.Local = true;
170 WriteTextureData(httpRequest, httpResponse, newTexture, format);
171 return true;
172 }
173 } 152 }
153 if (format == DefaultFormat)
154 {
155 WriteTextureData(httpRequest, httpResponse, texture, format);
156 return true;
157 }
158
159 // need to convert format
160 AssetBase newTexture = new AssetBase(texture.ID + "-" + format, texture.Name, (sbyte)AssetType.Texture, texture.Metadata.CreatorID);
161 newTexture.Data = ConvertTextureData(texture, format);
162 if (newTexture.Data.Length == 0)
163 return false; // !!! Caller try another codec, please!
164
165 newTexture.Flags = AssetFlags.Collectable;
166 newTexture.Temporary = true;
167 newTexture.Local = true;
168 WriteTextureData(httpRequest, httpResponse, newTexture, format);
169 return true;
174 } 170 }
175 171
176 // not found 172 // not found
177 // m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found"); 173 // m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
178 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; 174 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
179 return true; 175 return true;
180 } 176 }