本文整理汇总了C#中IHttpServer.SendHTML500方法的典型用法代码示例。如果您正苦于以下问题:C# IHttpServer.SendHTML500方法的具体用法?C# IHttpServer.SendHTML500怎么用?C# IHttpServer.SendHTML500使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHttpServer
的用法示例。
在下文中一共展示了IHttpServer.SendHTML500方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AsyncHttpRequest
//.........这里部分代码省略.........
string uri = request["uri"].ToString();
bool is_ssl = uri.Contains("lslhttps");
try
{
Hashtable headers = (Hashtable)request["headers"];
//HTTP server code doesn't provide us with QueryStrings
string queryString = "";
int pos1 = uri.IndexOf("/");// /lslhttp
int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/
int pos3 = uri.IndexOf("/", pos2 + 1);// /lslhttp/<UUID>/
string pathInfo = uri.Substring(pos3);
string url = URLFromURI(uri);
UrlData urlData = null;
lock (m_UrlMap)
{
m_UrlMap.TryGetValue(url, out urlData);
// Returning NULL sends a 404 from the base server
if (urlData == null)
asyncRequest.SendResponse(server.SendHTML404(httpResponse));
}
//for llGetHttpHeader support we need to store original URI here
//to make x-path-info / x-query-string / x-script-url / x-remote-ip headers
//as per http://wiki.secondlife.com/wiki/LlGetHTTPHeader
RequestData requestData =
new RequestData
{
requestId = asyncRequest.RequestID,
polledRequest = asyncRequest,
requestDone = false,
startTime = Environment.TickCount,
uri = uri
};
if (requestData.headers == null)
requestData.headers = new Dictionary<string, string>();
// Copy in the headers, convert keys to lower case: See.
// http://wiki.secondlife.com/wiki/LlGetHTTPHeader
foreach (DictionaryEntry header in headers)
{
string key = (string)header.Key;
string value = (string)header.Value;
requestData.headers.Add(key.ToLower(), value);
}
foreach (DictionaryEntry de in request)
{
if (de.Key.ToString() == "querystringkeys")
{
String[] keys = (String[])de.Value;
foreach (String key in keys)
{
if (request.ContainsKey(key))
{
string val = (String)request[key];
queryString = queryString + key + "=" + val + "&";
}
}
if (queryString.Length > 1)
queryString = queryString.Substring(0, queryString.Length - 1);
}
}
//if this machine is behind DNAT/port forwarding, currently this is being
//set to address of port forwarding router
requestData.headers["x-remote-ip"] = httpRequest.RemoteIPEndPoint.ToString();
requestData.headers["x-path-info"] = pathInfo;
requestData.headers["x-query-string"] = queryString;
requestData.headers["x-script-url"] = urlData.url;
lock (m_RequestMap)
{
m_RequestMap.Add(requestID, requestData);
}
lock (m_UrlMap)
{
urlData.requests.Add(requestID);
}
urlData.engine.PostScriptEvent(urlData.itemID, "http_request", new Object[] { requestID.ToString(), request["http-method"].ToString(), request["body"].ToString() });
}
catch (Exception we)
{
m_log.Warn("[HttpRequestHandler]: http-in request failed");
m_log.Warn(we.Message);
m_log.Warn(we.StackTrace);
asyncRequest.SendResponse(server.SendHTML500(httpResponse));
}
}