Changeset 202 for binary-improvements/7dtd-server-fixes/src/NetConnections/Servers/Web/StaticHandler.cs
- Timestamp:
- Oct 23, 2014, 3:09:29 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/NetConnections/Servers/Web/StaticHandler.cs
r199 r202 24 24 public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, HttpListenerBasicIdentity user) 25 25 { 26 try { 27 string fn = req.Url.AbsolutePath.Remove (0, staticPart.Length); 26 string fn = req.Url.AbsolutePath.Remove (0, staticPart.Length); 28 27 29 byte[] content = cache.GetFileContent (datapath + "/" + fn); 30 if (content != null) { 31 resp.ContentType = MimeType.GetMimeType (Path.GetExtension (fn)); 32 resp.ContentLength64 = content.Length; 33 resp.OutputStream.Write (content, 0, content.Length); 34 } else { 35 resp.StatusCode = (int)HttpStatusCode.NotFound; 36 if (logMissingFiles) 37 Log.Out ("Web:Static:FileNotFound: \"" + req.Url.AbsolutePath + "\" @ \"" + datapath + "/" + req.Url.AbsolutePath.Remove (0, staticPart.Length) + "\""); 38 return; 39 } 40 } catch (Exception e) { 41 Log.Out ("Error in StaticHandler.HandleRequest: " + e); 28 byte[] content = cache.GetFileContent (datapath + "/" + fn); 29 if (content != null) { 30 resp.ContentType = MimeType.GetMimeType (Path.GetExtension (fn)); 31 resp.ContentLength64 = content.Length; 32 resp.OutputStream.Write (content, 0, content.Length); 33 } else { 34 resp.StatusCode = (int)HttpStatusCode.NotFound; 35 if (logMissingFiles) 36 Log.Out ("Web:Static:FileNotFound: \"" + req.Url.AbsolutePath + "\" @ \"" + datapath + "/" + req.Url.AbsolutePath.Remove (0, staticPart.Length) + "\""); 37 return; 42 38 } 43 39 }
Note:
See TracChangeset
for help on using the changeset viewer.