nissing files

master
UbitUmarov 2020-04-02 21:52:31 +01:00
parent 67cd5efab3
commit fe9df55410
3 changed files with 29 additions and 33 deletions

View File

@ -105,7 +105,7 @@ namespace OpenSim.Capabilities.Handlers
} }
LLSDxmlEncode.AddEndMap(lsl); LLSDxmlEncode.AddEndMap(lsl);
return LLSDxmlEncode.End(lsl);; return LLSDxmlEncode.End(lsl);
} }
} }
} }

View File

@ -137,27 +137,13 @@ namespace OpenSim.Capabilities.Handlers
return responsedata; return responsedata;
} }
if (type == AssetType.Mesh || type == AssetType.Texture) int len = asset.Data.Length;
{
responsedata["throttle"] = true;
responsedata["prio"] = 2;
}
responsedata["content_type"] = asset.Metadata.ContentType;
responsedata["bin_response_data"] = asset.Data;
responsedata["int_bytes"] = asset.Data.Length;
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
string range = String.Empty; string range = String.Empty;
if (((Hashtable)request["headers"])["range"] != null) if (((Hashtable)request["headers"])["range"] != null)
range = (string)((Hashtable)request["headers"])["range"]; range = (string)((Hashtable)request["headers"])["range"];
else if (((Hashtable)request["headers"])["Range"] != null) else if (((Hashtable)request["headers"])["Range"] != null)
range = (string)((Hashtable)request["headers"])["Range"]; range = (string)((Hashtable)request["headers"])["Range"];
else
return responsedata; // full asset
if (String.IsNullOrEmpty(range))
return responsedata; // full asset
// range request // range request
int start, end; int start, end;
@ -177,7 +163,7 @@ namespace OpenSim.Capabilities.Handlers
end = Utils.Clamp(end, 0, asset.Data.Length - 1); end = Utils.Clamp(end, 0, asset.Data.Length - 1);
start = Utils.Clamp(start, 0, end); start = Utils.Clamp(start, 0, end);
int len = end - start + 1; len = end - start + 1;
//m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); //m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
Hashtable headers = new Hashtable(); Hashtable headers = new Hashtable();
@ -185,12 +171,19 @@ namespace OpenSim.Capabilities.Handlers
responsedata["headers"] = headers; responsedata["headers"] = headers;
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent; responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent;
responsedata["bin_start"] = start; responsedata["bin_start"] = start;
responsedata["int_bytes"] = len;
return responsedata;
} }
else
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
m_log.Warn("[GETASSETS]: Failed to parse a range, sending full asset: " + assetStr); responsedata["content_type"] = asset.Metadata.ContentType;
return responsedata; responsedata["bin_response_data"] = asset.Data;
responsedata["int_bytes"] = len;
if (type == AssetType.Mesh || type == AssetType.Texture)
{
responsedata["throttle"] = true;
responsedata["prio"] = len < 8196 ? 1 : 2;
}
return responsedata; // full asset
} }
} }
} }

View File

@ -137,7 +137,7 @@ namespace OpenSim.Capabilities.Handlers
string textureUrl = m_RedirectURL + "?texture_id=" + textureID.ToString(); string textureUrl = m_RedirectURL + "?texture_id=" + textureID.ToString();
m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl); m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl);
httpResponse.StatusCode = (int)OSHttpStatusCode.RedirectMovedPermanently; httpResponse.StatusCode = (int)OSHttpStatusCode.RedirectMovedPermanently;
httpResponse.RedirectLocation = textureUrl; httpResponse.AddHeader("Location:", textureUrl);
return true; return true;
} }
@ -238,8 +238,9 @@ namespace OpenSim.Capabilities.Handlers
response.ContentLength = len; response.ContentLength = len;
response.ContentType = texture.Metadata.ContentType; response.ContentType = texture.Metadata.ContentType;
response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length)); response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length));
response.RawBuffer = texture.Data;
response.Body.Write(texture.Data, start, len); response.RawBufferStart = start;
response.RawBufferLen = len;
} }
} }
else else
@ -257,17 +258,19 @@ namespace OpenSim.Capabilities.Handlers
response.ContentType = texture.Metadata.ContentType; response.ContentType = texture.Metadata.ContentType;
else else
response.ContentType = "image/" + format; response.ContentType = "image/" + format;
response.Body.Write(texture.Data, 0, texture.Data.Length); response.RawBuffer = texture.Data;
response.RawBufferStart = 0;
response.RawBufferLen = texture.Data.Length;
} }
// if (response.StatusCode < 200 || response.StatusCode > 299) // if (response.StatusCode < 200 || response.StatusCode > 299)
// m_log.WarnFormat( // m_log.WarnFormat(
// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})", // "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length); // texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
// else // else
// m_log.DebugFormat( // m_log.DebugFormat(
// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})", // "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length); // texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
} }
/// <summary> /// <summary>