- Timestamp:
- Aug 6, 2022, 11:32:32 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements2/MapRendering/Web/Handlers/StaticHandler.cs
r382 r387 2 2 using System.Net; 3 3 using AllocsFixes.FileCache; 4 using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;5 using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;6 4 7 5 namespace AllocsFixes.NetConnections.Servers.Web.Handlers { … … 18 16 } 19 17 20 public override void HandleRequest (string _requestPath, HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _con, 21 int _permissionLevel) { 22 string fn = _requestPath.Remove (0, urlBasePath.Length); 18 public override void HandleRequest (RequestContext _context) { 19 string fn = _context.RequestPath.Remove (0, urlBasePath.Length); 23 20 24 21 byte[] content = cache.GetFileContent (datapath + fn); 25 22 26 23 if (content != null) { 27 _ resp.ContentType = MimeType.GetMimeType (Path.GetExtension (fn));28 _ resp.ContentLength64 = content.Length;29 _ resp.OutputStream.Write (content, 0, content.Length);24 _context.Response.ContentType = MimeType.GetMimeType (Path.GetExtension (fn)); 25 _context.Response.ContentLength64 = content.Length; 26 _context.Response.OutputStream.Write (content, 0, content.Length); 30 27 } else { 31 _ resp.StatusCode = (int) HttpStatusCode.NotFound;28 _context.Response.StatusCode = (int) HttpStatusCode.NotFound; 32 29 if (logMissingFiles) { 33 Log.Out ("Web:Static:FileNotFound: \"" + _ requestPath + "\" @ \"" + datapath + fn + "\"");30 Log.Out ("Web:Static:FileNotFound: \"" + _context.RequestPath + "\" @ \"" + datapath + fn + "\""); 34 31 } 35 32 }
Note:
See TracChangeset
for help on using the changeset viewer.